1- using System . Collections ;
2- using System . Collections . Generic ;
3- using UnityEngine ;
4-
5- public class ZOSimOccurrenceEditor : MonoBehaviour
6- {
7- // Start is called before the first frame update
8- void Start ( )
9- {
10-
11- }
1+ using UnityEngine ;
2+ using UnityEditor ;
3+ using ZO . Document ;
4+ namespace ZO . Editor {
5+
6+ [ CustomEditor ( typeof ( ZOSimOccurrence ) ) ]
7+ public class ZOSimOccurrenceEditor : UnityEditor . Editor {
8+
9+ public override void OnInspectorGUI ( ) {
10+
11+ DrawDefaultInspector ( ) ;
12+
13+ ZOSimOccurrence simOccurrence = ( ZOSimOccurrence ) target ;
14+
15+ if ( GUILayout . Button ( "Create Child Occurrence" ) ) {
16+ GameObject baseOccurrence = new GameObject ( $ "ChildOf{ simOccurrence . Name } ") ;
17+ baseOccurrence . transform . SetParent ( simOccurrence . transform , false ) ;
18+ ZOSimOccurrence occurrence = baseOccurrence . AddComponent < ZOSimOccurrence > ( ) ;
19+ GameObjectUtility . EnsureUniqueNameForSibling ( baseOccurrence ) ;
20+
21+
22+
23+ GameObject visuals = new GameObject ( "visuals" ) ;
24+ visuals . transform . SetParent ( occurrence . transform , false ) ;
25+
26+ GameObject collisions = new GameObject ( "collisions" ) ;
27+ collisions . transform . SetParent ( occurrence . transform , false ) ;
28+
29+ }
30+
31+ if ( GUILayout . Button ( "Create Sibling Occurrence" ) ) {
32+ GameObject baseOccurrence = new GameObject ( $ "SiblingOf{ simOccurrence . Name } ") ;
33+ baseOccurrence . transform . SetParent ( simOccurrence . transform . parent , false ) ;
34+ ZOSimOccurrence occurrence = baseOccurrence . AddComponent < ZOSimOccurrence > ( ) ;
35+ GameObjectUtility . EnsureUniqueNameForSibling ( baseOccurrence ) ;
36+
37+
38+ GameObject visuals = new GameObject ( "visuals" ) ;
39+ visuals . transform . SetParent ( occurrence . transform , false ) ;
40+
41+ GameObject collisions = new GameObject ( "collisions" ) ;
42+ collisions . transform . SetParent ( occurrence . transform , false ) ;
43+
44+ }
1245
13- // Update is called once per frame
14- void Update ( )
15- {
16-
46+ }
1747 }
18- }
48+ }
0 commit comments