void Start() { foreach (GameObject prefab in prefabsToLoad) { PrefabStorage.Add(prefab); } }
// This code is commented out because it is no longer used. It used to // migrate data inside of the prefab into the scene object. Now, we just // don't store scene objects inside of the prefab (we lose the ability to // save the state from play-mode, but that's okay) /// <summary> /// Attempts to migrate prefab storage into scene storage. /// </summary> private static void MigratePrefabIntoSceneStorage <T>() where T : fiPersistentEditorStorageItem { // Only try to do the migration once (per type) if (_didMigrate.Add(typeof(T)) == false) { return; } // We cannot migrate data while playing -- scene storage will not be // persisted if (Application.isPlaying) { return; } var prefabStorage = PrefabStorage.GetComponent <fiBaseStorageComponent <T> >(); var sceneStorage = SceneStorage.GetComponent <fiBaseStorageComponent <T> >(); // Nothing to migrate. if (prefabStorage == null || prefabStorage.Data == null) { return; } // Migrate everything into scene storage var toRemove = new List <fiUnityObjectReference>(); foreach (var entry in prefabStorage.Data) { if (AssetDatabase.Contains(entry.Key.Target)) { // data should stay in prefab storage, as the UnityObject // target does not live in the scene continue; } if (sceneStorage.Data.ContainsKey(entry.Key) == false) { // move directly into scene storage sceneStorage.Data[entry.Key] = entry.Value; } else { // copy into scene storage sceneStorage.Data[entry.Key].CopyFromAndClear(prefabStorage.Data[entry.Key]); } toRemove.Add(entry.Key); } foreach (var item in toRemove) { prefabStorage.Data.Remove(item); } fiLateBindings.EditorUtility.SetDirty(sceneStorage); fiLateBindings.EditorUtility.SetDirty(prefabStorage); }
void Start() { spawnManager = new SpawnManager(); prefabStorage = GetComponent <PrefabStorage>(); Road.manager = this; SpawnManager.manager = this; SpawnManager.prefabStorage = prefabStorage; }
void CreateClone() { Destroy(clone); GameObject prefab = GameObject.Find("prefabStorage"); PrefabStorage prefabStorage = prefab.GetComponent <PrefabStorage>(); clone = Instantiate(prefabStorage.miniPrefabs[bulletIdentity], miniPosition.position, Quaternion.identity) as GameObject; clone.transform.parent = transform; }
void Start() { prefabStorage = new PrefabStorage(); levelBuilder = new LevelBuilder(this); meshManager = new MeshManager(levelBuilder, prefabStorage, grid); GameObject.Find("WaterDrop").GetComponent <PlayerController>().Builder = levelBuilder; meshManager.CreateRoad(); isPlaying = true; }
void CreateClone() { Destroy(clone); Debug.Log("This is object number" + VerhicleController.bulletIdentity); GameObject prefab = GameObject.Find("prefabStorage"); PrefabStorage prefabStorage = prefab.GetComponent <PrefabStorage> (); clone = Instantiate(prefabStorage.miniPrefabs [bulletIdentity], miniPosition.position, Quaternion.identity) as GameObject; clone.transform.parent = transform; }
void Awake() { if (Instance != null && Instance != this) { Destroy(gameObject); } else { Instance = this; } }
public static GameObject CreateProjectile(string prefabid, GameObject owner) { Transform trans = owner.GetEyeTransform(); //Vector3 forward = trans.forward; Vector3 pos = trans.position; Quaternion rot = trans.rotation; var projectile = PrefabStorage.Instantiate(prefabid, pos, rot); return(projectile); }
public MeshManager(LevelBuilder levelBuilder, PrefabStorage prefabStorage, Grid grid) { this.levelBuilder = levelBuilder; this.prefabStorage = prefabStorage; this.grid = grid; movable = GameObject.Find("WaterDrop"); tiles = new List <TubeTile>(); nextTilePosition = new Vector3Int(0, 0, 0); nextRotation = Quaternion.identity; progress = 0; tileCount = 0; }
// Use this for initialization void OnTriggerEnter(Collider other) { GameObject prefab = GameObject.Find("prefabStorage"); PrefabStorage prefabStorage = prefab.GetComponent <PrefabStorage> (); if (other.gameObject.tag == "Bullet") { Destroy(this.gameObject); Vector3 pos = new Vector3(other.transform.position.x, 7f, other.transform.position.z); Instantiate(prefabStorage.originalPrefabs [VerhicleController.bulletIdentity], pos, Quaternion.identity); Debug.Log(VerhicleController.bulletIdentity); } }
/// <summary> /// Start is called before the first frame update /// </summary> void Start() { try { PrefabStorage str = GetComponent <PrefabStorage>(); _emoji[0] = str.m_verySadEmoji; _emoji[1] = str.m_sadEmoji; _emoji[2] = str.m_neuralEmoji; _emoji[3] = str.m_moodEmoju; _emoji[4] = str.m_veryMoodEmoji; m_emojiBoostPrefab = str.m_emojiBoostPrefab; } catch (Exception ex) { Debug.LogError("People Start Exception" + ex.Message); } }
public static void Dispatch(string name, Vector3 position, Quaternion rotation) { PrefabStorage.Instantiate(name, position, rotation); }