Example #1
0
    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
    }