コード例 #1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.BeginVertical();

            bool click = false;

            if (m_isSyncRequired)
            {
                EditorGUILayout.HelpBox("One or more prefabs have been changed. AssetLibrary need to be synchronized.", MessageType.Warning);
                click = GUILayout.Button("Synchronize");
            }

            m_projectGUI.OnGUI();
            m_assetsGUI.OnGUI();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            Asset.KeepRuntimeProjectInSync = EditorGUILayout.Toggle("Keep in sync", Asset.KeepRuntimeProjectInSync);
            EditorGUILayout.EndHorizontal();
            if (Asset.KeepRuntimeProjectInSync)
            {
                EditorGUILayout.HelpBox("Runtime project tree will be updated each time you launch runtime editor and will reflect all changes in this asset library", MessageType.Info);
            }

            if (EditorGUI.EndChangeCheck())
            {
                SaveAsset();
            }

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Button("Create Reference", GUILayout.Width(100));
            EditorGUILayout.EndHorizontal();

            if (click)
            {
                Asset.Sync();
                m_assetsGUI = new AssetLibraryAssetsGUI();
                m_assetsGUI.InitIfNeeded();
                m_assetsGUI.SetSelectedFolders(m_projectGUI.SelectedFolders);
                m_assetsGUI.OnEnable();
                m_isSyncRequired = false;
                SaveAsset();
            }

            EditorGUILayout.EndVertical();
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            //if(!EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode)
            //{
            //    return;
            //}

            EditorGUILayout.BeginVertical();
            if (m_isSyncRequired)
            {
                EditorGUILayout.HelpBox("One or more prefabs have been changed. AssetLibrary need to be synchronized.", MessageType.Warning);
                if (GUILayout.Button("Synchronize"))
                {
                    Asset.Sync();
                    m_assetsGUI = new AssetLibraryAssetsGUI();
                    m_assetsGUI.InitIfNeeded();
                    m_assetsGUI.SetSelectedFolders(m_projectGUI.SelectedFolders);
                    m_assetsGUI.OnEnable();
                    m_isSyncRequired = false;
                    SaveAsset();
                }
            }


            //bool canRenderAssetsGUI =  m_canRenderAssetsGUI;
            m_projectGUI.OnGUI();
            //if(canRenderAssetsGUI)
            {
                m_assetsGUI.OnGUI();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            Asset.KeepRuntimeProjectInSync = EditorGUILayout.Toggle("Keep in sync", Asset.KeepRuntimeProjectInSync);
            EditorGUILayout.EndHorizontal();
            if (Asset.KeepRuntimeProjectInSync)
            {
                EditorGUILayout.HelpBox("Runtime project tree will be updated each time you launch runtime editor and will reflect all changes in this asset library", MessageType.Info);
            }

            if (EditorGUI.EndChangeCheck())
            {
                SaveAsset();
            }

            EditorGUILayout.EndVertical();
        }