public static void _showCoreInstallerWindow() { if (!SessionState.GetBool(_shouldShowWindowKey, false)) { return; } SessionState.EraseBool(_shouldShowWindowKey); OneSignalSetupWindow.ShowWindow(); }
public static void _showCoreInstallerWindow() { if (!SessionState.GetBool(_shouldShowWindowKey, false)) { return; } SessionState.EraseBool(_shouldShowWindowKey); EditorApplication.delayCall += OneSignalSetupWindow.ShowWindow; }
static bool RestoreSessionState() { var json = SessionState.GetString(k_InMemorySceneStateSessionKey, null); if (string.IsNullOrEmpty(json)) { return(false); } s_CurrentInMemorySceneState = InMemorySceneState.Import(json); s_TempFolderBase = SessionState.GetString(k_TempFolderBaseSessionKey, Path.Combine(Path.GetTempPath(), Path.GetRandomFileName())); registeredTempFolder = SessionState.GetBool(k_RegisteredTempFolderSessionKey, false); // To make sure that we don't affect future session in case something happens, we delete everything SessionState.EraseString(k_InMemorySceneStateSessionKey); SessionState.EraseString(k_TempFolderBaseSessionKey); SessionState.EraseBool(k_RegisteredTempFolderSessionKey); return(true); }
public void OnDestroy() { SessionState.EraseBool($"EditorElement_{Component.GetInstanceID()}"); }
private static void Replacement() { EditorApplication.projectWindowItemOnGUI -= Replacement; EditorApplication.hierarchyWindowItemOnGUI -= Replacement; bool force = SessionState.GetBool(forcedKey, false); SessionState.EraseBool(forcedKey); if (force) { EditorApplication.delayCall += () => { Type consoleWindowType = Type.GetType("UnityEditor.ConsoleWindow,UnityEditor"); if (consoleWindowType == null) { return; } var consoleWindows = Resources.FindObjectsOfTypeAll(consoleWindowType); if (consoleWindows == null) { return; } foreach (Object consoleWindow in consoleWindows) { ((EditorWindow)consoleWindow).Repaint(); } }; } Font font; switch ((MonospacedConsoleSettings.Font)EditorPrefs.GetInt(FontKey, 0)) { case MonospacedConsoleSettings.Font.JetbrainsMono: font = AssetDatabase.LoadAssetAtPath <Font>("Packages/com.vertx.monospaced-console/JetbrainsMono-Regular.ttf"); break; case MonospacedConsoleSettings.Font.Consola: font = EditorResources.Load <Font>("consola.ttf"); break; default: return; } switch ((State)EditorPrefs.GetInt(StateKey, (int)DefaultState)) { case State.LogsAndMessage: ReplaceFont("CN Message"); ReplaceLogs(); break; case State.MessageOnly: ReplaceFont("CN Message"); if (force) { ReplaceLogs(false); } break; default: if (force) { ReplaceFont("CN Message", false); ReplaceLogs(false); } return; } void ReplaceLogs(bool replace = true) { ReplaceFont("CN EntryInfo", replace); ReplaceFont("CN EntryWarn", replace); ReplaceFont("CN EntryError", replace); ReplaceFont("CN EntryInfoSmall", replace); ReplaceFont("CN EntryWarnSmall", replace); ReplaceFont("CN EntryErrorSmall", replace); } void ReplaceFont(string guiStyle, bool replace = true) { GUIStyle style = guiStyle; style.font = replace ? font : null; style.fontSize = 12; } }