private void OnPlayModeStateChanged(PlayModeStateChange state) { switch (state) { case PlayModeStateChange.EnteredPlayMode: if (FindObjectOfType <EasyWorldBuilder>() == null) { runtimeEditor = new GameObject().AddComponent <EasyWorldBuilder>(); runtimeEditor.gameObject.name = "WorldBuilder Runtime Editor"; runtimeEditor.hideFlags = HideFlags.HideInHierarchy; } runtimeEditor.Settings = settings; runtimeEditor.SpawnController(placementMode); break; case PlayModeStateChange.ExitingPlayMode: //Save Assets on playmode exit runtimeEditor.SaveSys.SavePlacedAssets(); if (FindObjectOfType <EasyWorldBuilder>() != null) { Destroy(runtimeEditor.gameObject); } break; case PlayModeStateChange.EnteredEditMode: //Load Assets on editmode enter new LoadFromFile().LoadData(); break; } }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
private void Start() { mgr = FindObjectOfType <EasyWorldBuilder>(); scrollBar = GetComponentInChildren <VerticalLayoutGroup>(); //Draw initial UI buttons. for (int i = 0; i < mgr.PlaceableAssets.Count; i++) { addButton(mgr.PlaceableAssets[i]); } }
private void Awake() { _manager = FindObjectOfType <EasyWorldBuilder>(); _saveSys = FindObjectOfType <RuntimeSaving>(); FlyCam = gameObject.AddComponent <Camera>(); _charControl = gameObject.AddComponent <CharacterController>(); _charControl.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); gameObject.AddComponent <AudioListener>(); _fpsControl = gameObject.AddComponent <FirstPersonController>(); FpsCam = _fpsControl.m_Camera; _flyControl = gameObject.AddComponent <SimpleCameraController>(); }
private void Start() { Manager = EasyWorldBuilder.Instance; }