public void Initialize() { isRunning = false; disabledGameObjects.Clear(); controller = null; if (fragment.Controller != R.E.GameObject.None) { string gameObjectName = R.S.GameObject.ToString(fragment.Controller); GameObject gameObject = GameObject.Find(gameObjectName); if (gameObject == null) { Debug.LogError("Unable to find controller for Fragment : no GameObject of name \"" + gameObjectName + "\" found."); } else { controller = gameObject.GetComponentInChildren <IFragmentController>(); if (controller == null) { Debug.LogError("Unable to find controller for Fragment : no IFragmentController exists on GameObject named " + "\"" + gameObjectName + "\"."); } } } if (fragment.IsActiveOnLoad) { SceneManager.SetActiveScene(SceneManager.GetSceneByName(R.S.Scene.ToString(fragment.Scene))); } if (!IsStartedOnLoad()) { Disable(); } }
public void Initialize() { controller = null; if (fragment.Controller != R.E.GameObject.None) { string gameObjectName = R.S.GameObject.ToString(fragment.Controller); GameObject gameObject = GameObject.Find(gameObjectName); if (gameObject == null) { throw new ArgumentException("Unable to find controller for Fragment : no GameObject of name \"" + gameObjectName + "\" found."); } controller = gameObject.GetComponentInChildren <IFragmentController>(); if (controller == null) { throw new ArgumentException("Unable to find controller for Fragment : no IFragmentController exists " + "on GameObject of name \"" + gameObjectName + "\"."); } } }