Пример #1
0
        void OnEnable()
        {
            m_Settings = LoadUserSettings();

            ISetEditingContextMethods.getAvailableEditingContexts   = GetAvailableEditingContexts;
            ISetEditingContextMethods.getPreviousEditingContexts    = GetPreviousEditingContexts;
            ISetEditingContextMethods.setEditingContext             = SetEditingContext;
            ISetEditingContextMethods.restorePreviousEditingContext = RestorePreviousContext;

            var availableContexts = GetAvailableEditingContexts();

            m_ContextNames = availableContexts.Select(c => c.name).ToArray();

            if (m_AvailableContexts.Count == 0)
            {
                throw new Exception("You can't start EditorXR without at least one context. Try re-importing the package or use version control to restore the default context asset");
            }

            SetEditingContext(defaultContext);

            if (m_AvailableContexts.Count > 1)
            {
                VRView.afterOnGUI += OnVRViewGUI;
            }

            // Force the window to repaint every tick, since we need live updating
            // This also allows scripts with [ExecuteInEditMode] to run
            EditorApplication.update += EditorApplication.QueuePlayerLoopUpdate;

            EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
        }
Пример #2
0
        static EditingContextManagerSettings LoadProjectSettings()
        {
            EditingContextManagerSettings settings = ScriptableObject.CreateInstance <EditingContextManagerSettings>();

            if (File.Exists(k_SettingsPath))
            {
                JsonUtility.FromJsonOverwrite(File.ReadAllText(k_SettingsPath), settings);
            }

            return(settings);
        }
Пример #3
0
        internal static EditingContextManagerSettings LoadUserSettings()
        {
            EditingContextManagerSettings settings;

            if (File.Exists(k_UserSettingsPath) &&
                File.GetLastWriteTime(k_UserSettingsPath) > File.GetLastWriteTime(k_SettingsPath))
            {
                settings = ScriptableObject.CreateInstance <EditingContextManagerSettings>();
                JsonUtility.FromJsonOverwrite(File.ReadAllText(k_UserSettingsPath), settings);
            }
            else
            {
                settings = LoadProjectSettings();
            }

            return(settings);
        }
Пример #4
0
        void OnEnable()
        {
            m_Settings = LoadUserSettings();

            ISetEditingContextMethods.getAvailableEditingContexts   = GetAvailableEditingContexts;
            ISetEditingContextMethods.getPreviousEditingContexts    = GetPreviousEditingContexts;
            ISetEditingContextMethods.setEditingContext             = SetEditingContext;
            ISetEditingContextMethods.restorePreviousEditingContext = RestorePreviousContext;

            var availableContexts = GetAvailableEditingContexts();

            m_ContextNames = availableContexts.Select(c => c.name).ToArray();

            SetEditingContext(defaultContext);

            if (m_AvailableContexts.Count > 1)
            {
                VRView.afterOnGUI += OnVRViewGUI;
            }
        }
Пример #5
0
 static void SaveUserSettings(EditingContextManagerSettings settings)
 {
     File.WriteAllText(k_UserSettingsPath, JsonUtility.ToJson(settings, true));
 }
Пример #6
0
        internal static void SaveUserSettings(EditingContextManagerSettings settings)
        {
#if UNITY_EDITOR
            File.WriteAllText(userSettingsPath, JsonUtility.ToJson(settings, true));
#endif
        }
Пример #7
0
 void Awake()
 {
     m_ContextNames         = EditingContextManager.GetEditingContextNames();
     m_Settings             = (EditingContextManagerSettings)target;
     m_SelectedContextIndex = Array.IndexOf(m_ContextNames, m_Settings.defaultContextName);
 }