I am creating a large editor system for my game for Unity.
It is within a single UnityWindow (OnGUI()) with buttons down the left handside for each of the different editor types. Upon clicking on an editor it opens a sub window (GUILayout.Window).
I would like all the code for each of these sub windows to be in separate classes so I dont need a 10000 lines in a single file. However at the moment I have not found a way of doing this.
Code Outline
public class Designer : EditorWindow {
void OnGUI(){
BeginWindows();
GUILayout.BeginVertical();
switch(currentEditor){
case editors.GameLogic:
GUILayout.Window (1, editorRect, GameLogic, "Game Logic Editor");
break;
// ETC... case editors.Room:
default:
Debug.Log ("No Editor was selected");
break;
}
GUILayout.EndVertical();
EndWindows ();
} // End of OnGUI()
//------- This function is what I would like to separate into another class ------//
public void GameLogic(int windowID){
indexNew = EditorGUI.Popup(new Rect(startX, startY, 300, height), "Modify Room:", indexNew, RoomNameList);
//etc
}
// ------- -------------- ------------///
} // End of Designer Class
At the moment doing this is beyond my skills. Any pointers would be gratefully received.
Thank you