void Awake() { // Since there should only be 1 PrefabInstantiator instance, assign this // instance to a global var. P = this; canvasObj = GameObject.Find("Canvas"); skillButtonRowObj = GameObject.Find("SkillButtonRow"); }
public static void OnPostprocessScene() { var unvisitedInstantiators = new Stack <PrefabInstantiator>(FindObjectsOfType <PrefabInstantiator>()); while (unvisitedInstantiators.Count > 0) { PrefabInstantiator currentInstantiator = unvisitedInstantiators.Pop(); if (currentInstantiator.BakeInstantiationWhenPossible) { GameObject instantiatedPrefab = currentInstantiator.TryInstantiatePrefab(); if (instantiatedPrefab) { foreach (PrefabInstantiator newSubstitution in instantiatedPrefab.GetComponentsInChildren <PrefabInstantiator>()) { unvisitedInstantiators.Push(newSubstitution); } } } } }
void Awake() { // Since there should only be 1 PrefabInstantiator instance, assign this instance to a // global var. P = this; }