예제 #1
0
        private void ConnectParent()
        {
            // set parent
            if (Container.Parent == null)
            {
                // context from object hierarchy
                GameObjectContext goContext = null;
                if (transform.parent != null)
                {
                    goContext = transform.parent.GetComponentInParent <GameObjectContext>();
                }

                if (goContext != null)
                {
                    Container.Parent = goContext.GetContainer();
                }
                else
                {
                    // scene's context if one exists
                    SceneContext sceneContext;
                    if (SceneContext.TryGetSceneContext(gameObject.scene.path, out sceneContext))
                    {
                        Container.Parent = sceneContext.GetContainer();
                    }
                    // fallback to project's context
                    else
                    {
                        Container.Parent = ProjectContext.Instance.GetContainer();
                    }
                }
            }
        }
예제 #2
0
 public static bool TryGetSceneContext(string scenePath, out SceneContext sceneContext)
 {
     return(s_sceneContexts.TryGetValue(scenePath, out sceneContext));
 }