35 lines
878 B
C#
35 lines
878 B
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
#if UNITY_EDITOR
|
|
public class FixedMainEditor
|
|
{
|
|
private const string FixedMainKey = "IsFixedMain";
|
|
public static bool isFixedMain
|
|
{
|
|
get
|
|
{
|
|
return PlayerPrefs.GetInt(FixedMainKey, 0) == 1;
|
|
}
|
|
set
|
|
{
|
|
PlayerPrefs.SetInt(FixedMainKey, value ? 1 : 0);
|
|
PlayerPrefs.Save();
|
|
}
|
|
}
|
|
|
|
[MenuItem("Tools/强制Main场景启动 %#x", false, 10)]
|
|
private static void ToggleOption()
|
|
{
|
|
isFixedMain = !isFixedMain;
|
|
EditorUtility.DisplayDialog("Option Status", "Option is now " + (isFixedMain ? "enabled" : "disabled"), "OK");
|
|
}
|
|
|
|
[MenuItem("Tools/强制Main场景启动 %#x", true, 10)]
|
|
private static bool ValidateToggleOption()
|
|
{
|
|
Menu.SetChecked("Tools/强制Main场景启动", isFixedMain);
|
|
return true;
|
|
}
|
|
}
|
|
#endif |