コード例 #1
0
        private static void Unregister(UTinyEntityView view)
        {
            if (!ActiveViews.Remove(view))
            {
                return;
            }

            if (ActiveViews.Count == 0)
            {
                Undo.postprocessModifications -= HandlePostProcessModification;
            }

            // From this point, we know that the entity view is being destroyed. What we do not know is if the view is
            // being destroyed because we are unloading the scene or if the user deleted the entity through the hierarchy
            // or the scene view.
            var entity = view.EntityRef.Dereference(Registry);

            if (entity?.EntityGroup == null)
            {
                return;
            }

            var entityGroupRef = (UTinyEntityGroup.Reference)entity.EntityGroup;

            if (UnloadingEntityGroups.Contains(entityGroupRef))
            {
                return;
            }

            entity.View = null;

            var graph = EntityGroupManager.GetSceneGraph(entityGroupRef);

            if (null == graph)
            {
                return;
            }

            graph.Delete(graph.FindNode(view.EntityRef));
            UTinyHierarchyWindow.InvalidateSceneGraph();
        }
コード例 #2
0
 private static void HandleEntityGroupUnloaded(UTinyEntityGroup.Reference entityGroupRef)
 {
     UnloadingEntityGroups.Remove(entityGroupRef);
 }
コード例 #3
0
 private static void HandleEntityGroupWillUnload(UTinyEntityGroup.Reference entityGroupRef)
 {
     UnloadingEntityGroups.Add(entityGroupRef);
 }