public override void OnInspectorGUI() { aux = (MeshArray)target; if (GUILayout.Button("Update")) { Quaternion rot = aux.transform.rotation; aux.transform.rotation = Quaternion.identity; aux.UpdateArray(); aux.transform.rotation = rot; EditorUtility.SetDirty(aux); } base.OnInspectorGUI(); }
private void ChangeModel(GameObject pref) { #if UNITY_EDITOR GameObject obj = PrefabUtility.InstantiatePrefab(pref) as GameObject; obj.transform.position = transform.position; Selection.activeGameObject = obj; if (array) { ObjArray o = obj.GetComponent <ObjArray>(); if (o) { o.array = array; } obj.transform.SetParent(array.transform, true); int num = array.objs.FindIndex(Find); array.objs[num] = obj; EditorUtility.SetDirty(array); array.UpdateArray(); } UnityEditor.EditorApplication.delayCall += () => { DestroyImmediate(gameObject); }; #endif }