private static bool DrawPlayerTemplateWithRemoveButton(PlayerTemplate playerTemplate, bool withRemoveButton) { EditorGUI.indentLevel++; playerTemplate.playerName = EditorGUILayout.TextField("Name", playerTemplate.playerName); SimpleGUI.DrawFoldout(playerTemplate, "More settings", () => { playerTemplate.avatarPrefab = SimpleGUI.ObjectField("Custom avatar", playerTemplate.avatarPrefab, false); playerTemplate.spawnPoint = SimpleGUI.ObjectField("Custom spawn point", playerTemplate.spawnPoint, true); playerTemplate.customId = EditorGUILayout.IntField("Custom id", playerTemplate.customId); }); GUILayout.BeginHorizontal(); GUILayout.Label("Has Vr"); playerTemplate.hasVr = EditorGUILayout.Toggle(playerTemplate.hasVr); GUILayout.Label("Join on start"); playerTemplate.joinByDefault = EditorGUILayout.Toggle(playerTemplate.joinByDefault); bool remove = false; if (withRemoveButton) { remove = GUILayout.Button("Remove"); } GUILayout.EndHorizontal(); EditorGUI.indentLevel--; return(remove); }
private static void AvatarChangeDialog(SimulatedVRCPlayer player) { GameObject avatar = player.SetMetadata <GameObject>("avatar", oldValue => SimpleGUI.ObjectField("Avatar", oldValue, false)); if (avatar != null) { SimpleGUI.ActionButton("Change Avatar", () => player.ChangeAvatar(avatar)); } }
private void DrawGlobalOptions(GotoUdonSettings settings) { settings.Init(); if (!settings.IsSimulatorInstalled) { SimpleGUI.ActionButton("Install legacy simulator (probably doesnt work)", () => settings.IsSimulatorInstalled = true); } else { SimpleGUI.ActionButton("Remove simulator", () => settings.IsSimulatorInstalled = false); } #if GOTOUDON_SIMULATION_LEGACY SimpleGUI.ErrorBox(settings.avatarPrefab == null, "You need to select some avatar prefab to use this resource. You can find ybot-mini in Assets folder with this resource."); SimpleGUI.ErrorBox(settings.spawnPoint == null, "You need to select some spawn point to use this resource!"); GUILayout.Label("Global settings"); SimpleGUI.Indent(() => { settings.enableSimulation = EditorGUILayout.Toggle("Enable simulation", settings.enableSimulation); settings.avatarPrefab = SimpleGUI.ObjectField("Avatar prefab", settings.avatarPrefab, false); settings.spawnPoint = SimpleGUI.ObjectField("Spawn point", settings.spawnPoint, true); }); // nah, not really working // SimpleGUI.DrawFoldout(this, "Advanced settings", () => // { // SimpleGUI.WarningBox(true, // "Enabling vrchat client mode might cause some issues, but also allow to test your scripts with secure heap enabled\n" + // "This will add or remove VRC_CLIENT define for compiler, meaning that all internal sdk code will think its running on client and not in editor.\n" + // "Use at own risk."); // string VRC_CLIENT = "VRC_CLIENT"; // bool vrchatClientMode = UnityCompilerUtils.IsDefineEnabled(VRC_CLIENT); // string buttonName = vrchatClientMode ? "Use vrchat editor mode" : "Use vrchat client mode"; // SimpleGUI.ActionButton(buttonName, () => UnityCompilerUtils.SetDefineEnabled(VRC_CLIENT, !vrchatClientMode)); // }); #endif }