Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEditor;
- using System.Collections.Generic;
- public class ClassWindow : EditorWindow
- {
- private static ClassWindow window;
- public List< ClassA > list;
- [MenuItem ("My Window/Class")]
- static void Init ()
- {
- window = EditorWindow.GetWindow (typeof (ClassWindow)) as ClassWindow;
- Debug.Log("Init");
- }
- private void OnGUI()
- {
- if( list == null )
- list = new List<ClassA>();
- if( GUI.Button( new Rect( 10, 10, 100, 100 ), "Add Class A" ) )
- list.Add( new ClassA() );
- if( GUI.Button( new Rect( 110, 10, 100, 100 ), "Add Class B" ) )
- list.Add( new ClassB() );
- // Once you compile again, this is going to display only 'AAAAAAAAA'
- GUILayout.BeginArea( new Rect( 10, 110, 200, 200 ) );
- GUILayout.Space(20);
- GUILayout.Label( "Childcount : " + list.Count );
- GUILayout.Space(20);
- foreach( ClassA a in list )
- a.Draw();
- GUILayout.EndArea();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement