private static void CreateAssetLibraryForScene(Scene scene, int index, AssetLibraryAsset asset, AssetFolderInfo folder, HashSet <UnityObject> hs) { TypeMap typeMap = new TypeMap(); AssetDB assetDB = new AssetDB(); RuntimeShaderUtil shaderUtil = new RuntimeShaderUtil(); IOC.Register <ITypeMap>(typeMap); IOC.Register <IAssetDB>(assetDB); IOC.Register <IRuntimeShaderUtil>(shaderUtil); PersistentRuntimeScene rtScene = new PersistentRuntimeScene(); GetDepsFromContext ctx = new GetDepsFromContext(); rtScene.GetDepsFrom(scene, ctx); Queue <UnityObject> depsQueue = new Queue <UnityObject>(ctx.Dependencies.OfType <UnityObject>()); GetDepsFromContext getDepsCtx = new GetDepsFromContext(); while (depsQueue.Count > 0) { UnityObject uo = depsQueue.Dequeue(); if (!uo) { continue; } Type persistentType = typeMap.ToPersistentType(uo.GetType()); if (persistentType != null) { getDepsCtx.Clear(); try { PersistentObject persistentObject = (PersistentObject)Activator.CreateInstance(persistentType); //persistentObject.ReadFrom(uo); persistentObject.GetDepsFrom(uo, getDepsCtx); } catch (Exception e) { Debug.LogError(e); } foreach (UnityObject dep in getDepsCtx.Dependencies) { if (!ctx.Dependencies.Contains(dep)) { ctx.Dependencies.Add(dep); depsQueue.Enqueue(dep); } } } } IOC.Unregister <IRuntimeShaderUtil>(shaderUtil); IOC.Unregister <ITypeMap>(typeMap); IOC.Unregister <IAssetDB>(assetDB); CreateAssetLibrary(ctx.Dependencies.ToArray(), "Scenes/" + scene.name, "SceneAssetLibrary", index, asset, folder, hs); }
protected override void OnEditorClosed() { base.OnEditorClosed(); IOC.Unregister <IRenderersCache>("ProBuilder.SelectionPickerCache", m_selectionPickerCache); Destroy(m_selectionPickerCache); m_selectionPickerCache = null; }
private void OnDestroy() { if (m_editor != null) { m_editor.Selection.SelectionChanged -= OnRuntimeEditorSelectionChanged; m_editor.Object.Enabled -= OnObjectEnabled; m_editor.Object.Disabled -= OnObjectDisabled; } IOC.Unregister <ICustomOutlineRenderersCache>("CustomOutlineRenderersCache", this); }
protected override void OnDestroy() { base.OnDestroy(); if (Editor != null) { Editor.PlaymodeStateChanged -= OnPlaymodeStateChanged; Editor.Selection.SelectionChanged -= OnSelectionChanged; } IOC.Unregister <IRTEState>(this); IOC.Unregister <IResourcePreviewUtility>(m_resourcePreview); }
private void OnDestroy() { if (m_editor != null) { m_editor.Selection.SelectionChanged -= OnRuntimeEditorSelectionChanged; } if (m_selectionOverride != null) { m_selectionOverride.SelectionChanged -= OnSelectionChanged; } IOC.Unregister("SelectedRenderers", m_cache); IOC.UnregisterFallback <IOutlineManager>(this); }
private void OnDestroy() { if (m_instance == this) { m_instance = null; } OnDestroyOverride(); IOC.Unregister <IRTE>(m_rte); IOC.Unregister(m_rte); m_resourcePreview = null; m_rteAppearance = null; m_rte = null; }
protected override void OnDestroy() { base.OnDestroy(); IOC.Unregister <IRTE>(this); IOC.UnregisterFallback(this); PlaymodeStateChanged -= OnPlaymodeStateChanged; IsOpenedChanged -= OnIsOpenedChanged; Selection.SelectionChanged -= OnRuntimeSelectionChanged; Tools.ToolChanged -= OnRuntimeToolChanged; Tools.PivotRotationChanged -= OnPivotRotationChanged; Undo.RedoCompleted -= OnUndoCompleted; Undo.RedoCompleted -= OnRedoCompleted; Undo.StateChanged -= OnUndoRedoStateChanged; Object.Awaked -= OnAwaked; Object.Destroyed -= OnDestroyed; }
private static void CreateAssetLibraryForScene(Scene scene, int index, AssetLibraryAsset asset, AssetFolderInfo folder, HashSet <UnityObject> hs) { TypeMap typeMap = new TypeMap(); AssetDB assetDB = new AssetDB(); IOC.Register <ITypeMap>(typeMap); IOC.Register <IAssetDB>(assetDB); PersistentRuntimeScene rtScene = new PersistentRuntimeScene(); GetDepsFromContext ctx = new GetDepsFromContext(); rtScene.GetDepsFrom(scene, ctx); IOC.Unregister <ITypeMap>(typeMap); IOC.Unregister <IAssetDB>(assetDB); CreateAssetLibrary(ctx.Dependencies.ToArray(), "Scenes/" + scene.name, "SceneAssetLibrary", index, asset, folder, hs); }
private void OnDestroy() { IOC.Unregister("HighlightRenderers", m_cache); if (m_editor != null) { if (m_editor.Object != null) { m_editor.Object.Enabled -= OnObjectEnabled; m_editor.Object.Disabled -= OnObjectDisabled; m_editor.Object.ComponentAdded -= OnComponentAdded; } if (m_editor.Selection != null) { m_editor.Selection.SelectionChanged -= OnSelectionChanged; } m_editor.ActiveWindowChanged -= OnActiveWindowChanged; } }
private void OnDestroy() { if (m_instance == this) { m_instance = null; } OnDestroyOverride(); IOC.Unregister <IRTE>(m_rte); IOC.Unregister(m_rte); m_resourcePreview = null; m_rteAppearance = null; m_windowManager = null; m_console = null; m_gameObjectCmd = null; m_editCmd = null; m_contextMenu = null; m_runtimeHandlesComponent = null; m_editorsMap = null; }
private void OnDisable() { IOC.Unregister("TerrainLayerEditor", this); }
private static void CreateAssetLibraryFromScene(Scene scene, int index, AssetLibraryAsset asset, AssetFolderInfo folder, HashSet <UnityObject> hs) { TypeMap typeMap = new TypeMap(); AssetDB assetDB = new AssetDB(); IOC.Register <ITypeMap>(typeMap); IOC.Register <IAssetDB>(assetDB); PersistentRuntimeScene rtScene = new PersistentRuntimeScene(); GetDepsFromContext ctx = new GetDepsFromContext(); rtScene.GetDepsFrom(scene, ctx); IOC.Unregister <ITypeMap>(typeMap); IOC.Unregister <IAssetDB>(assetDB); int identity = asset.AssetLibrary.Identity; foreach (UnityObject obj in ctx.Dependencies) { if (hs.Contains(obj)) { continue; } if (obj is GameObject) { GameObject go = (GameObject)obj; if (go.IsPrefab()) { AssetInfo assetInfo = new AssetInfo(go.name, 0, identity); assetInfo.Object = go; identity++; List <PrefabPartInfo> prefabParts = new List <PrefabPartInfo>(); AssetLibraryAssetsGUI.CreatePefabParts(go, ref identity, prefabParts); if (prefabParts.Count >= AssetLibraryInfo.MAX_ASSETS - AssetLibraryInfo.INITIAL_ID) { EditorUtility.DisplayDialog("Unable Create AssetLibrary", string.Format("Max 'Indentity' value reached. 'Identity' == {0}", AssetLibraryInfo.MAX_ASSETS), "OK"); return; } if (identity >= AssetLibraryInfo.MAX_ASSETS) { SaveAssetLibrary(asset, scene, index); index++; asset = ScriptableObject.CreateInstance <AssetLibraryAsset>(); folder = asset.AssetLibrary.Folders.Where(f => f.depth == 0).First(); identity = asset.AssetLibrary.Identity; } assetInfo.PrefabParts = prefabParts; asset.AssetLibrary.Identity = identity; folder.Assets.Add(assetInfo); } } else { AssetInfo assetInfo = new AssetInfo(obj.name, 0, identity); assetInfo.Object = obj; identity++; if (identity >= AssetLibraryInfo.MAX_ASSETS) { SaveAssetLibrary(asset, scene, index); index++; asset = ScriptableObject.CreateInstance <AssetLibraryAsset>(); folder = asset.AssetLibrary.Folders.Where(f => f.depth == 0).First(); identity = asset.AssetLibrary.Identity; } asset.AssetLibrary.Identity = identity; folder.Assets.Add(assetInfo); } } SaveAssetLibrary(asset, scene, index); index++; Selection.activeObject = asset; EditorGUIUtility.PingObject(asset); }
private void OnDestroy() { IOC.Unregister(m_materialUtils); }
protected override void OnDestroy() { base.OnDestroy(); IOC.Unregister(InstantiateTerrainProjector); }