public override void OnInspectorGUI() { CSInstantiatorLights bm = (CSInstantiatorLights)target; GUILayout.Box(banner, GUILayout.ExpandWidth(true)); bm.originalObject = EditorGUILayout.ObjectField("Original Object", bm.originalObject, typeof(GameObject), true) as GameObject; if (GUILayout.Button("Update Template")) { bm.Awake(); bm.UpdateElements(); } bm.instancesX = EditorGUILayout.IntField("Instances", bm.instancesX); bm.offsetX = EditorGUILayout.IntField("Offset X", bm.offsetX); bm.instancesZ = EditorGUILayout.IntField("Instances", bm.instancesZ); bm.offsetZ = EditorGUILayout.IntField("Offset Z", bm.offsetZ); bm.width = EditorGUILayout.IntField("Width", bm.width); bm.depth = EditorGUILayout.IntField("Depth", bm.depth); if (GUI.changed) { bm.Awake(); bm.UpdateElements(); EditorUtility.SetDirty(bm); } }
void OnEnable() { CSInstantiatorLights bm = (CSInstantiatorLights)target; banner = Resources.Load("CSHeader") as Texture; bm.Awake(); bm.UpdateElements(); }
public void UpdateLightsLods() { CSRandomizerComponent = gameObject.GetComponent <CityRandomizer>(); csDetailsObject = CSRandomizerComponent.streetLights; foreach (Transform go in csDetailsObject.transform.Cast <Transform>().Reverse()) { CSInstantiatorLights poles = go.GetComponent(typeof(CSInstantiatorLights)) as CSInstantiatorLights; poles.offsetX = lightsDistance; poles.offsetZ = lightsDistance; poles.UpdateElements(); } }