Skip to content

Instantly share code, notes, and snippets.

@ZeredaGames
Last active February 27, 2019 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeredaGames/91fa29616772cdc944ba671295a9816e to your computer and use it in GitHub Desktop.
Save ZeredaGames/91fa29616772cdc944ba671295a9816e to your computer and use it in GitHub Desktop.
Expanding furthuer on our code.
namespace ZeredaGamesEngine.Core.MusicListsExamples.Example3
{
#region Attributes
//[RequireComponent (typeof())]
//[System.Serializable]
#endregion
public class EditorWindowTutorial : EditorWindow
{
#region Variables
///<summary> Sets Defaults in update.</summary>
public static bool setDefaults;
public bool DebugMode;
#endregion
#region Unity Methods
///<summary> Awake is called when the script instance is being loaded.</summary>
void Awake()
{
DebugMode = GetDebugMode;
}
///<summary> Start is called just before any of the Update methods is called the first time.</summary>
void Start()
{
}
///<summary> Update is called every frame, if the MonoBehaviour is enabled.</summary>
void Update()
{
}
#endregion
#region ZeredaGames Methods
#region Option A
///<summary> Can be used for starting this instance.</summary>
[MenuItem("Window/Editor Tools/ZeredaGames/Game Making Editor Tools/Open My Custom Editor Window Initialize A")]
public static void StaticInitializeA()
{
EditorWindowTutorial window = (EditorWindowTutorial)EditorWindow.GetWindow(typeof(EditorWindowTutorial));
}
#endregion
#region Option B
private static EditorWindowTutorial window = null;
// adjust 0 to organize the list 0 is top so in this scripts set up like is, will result in B, A, C
[MenuItem("Window/Editor Tools/ZeredaGames/Game Making Editor Tools/Open My Custom Editor Window Initialize B", false, 0)]
public static void StaticInitializeB()
{
window = GetWindow;
}
private static EditorWindowTutorial GetWindow
{
get
{
return (EditorWindowTutorial)EditorWindow.GetWindow(typeof(EditorWindowTutorial), true, "Editor Window Tutorial (Look you can Write w.e you like here!))");
}
}
#endregion
#region Option C
[MenuItem("Window/Editor Tools/ZeredaGames/Game Making Editor Tools/Open My Custom Editor Window Initialize C", false, 2)]// adjust 0 to organize the list
public static void StaticInitializeC()
{
window = GetWindowWithRect;
}
//Cant add in your own Rect in the place of the new one and make it a static variable when you do.
private static EditorWindowTutorial GetWindowWithRect
{
get
{
return (EditorWindowTutorial)EditorWindow.GetWindowWithRect(typeof(EditorWindowTutorial),new Rect(100,100,500,500), true, "Editor Window Tutorial (Look you can Write w.e you like here!))");
}
}
#endregion
public static bool UseA = true, UseB = false, UseC = false;
public void Init()
{
if (UseA)
StaticInitializeA();
if (UseB)
StaticInitializeB();
if (UseC)
StaticInitializeC();
//Start writting here
}
public bool GetDebugMode
{
get
{
string message = PlayerPrefs.GetString("DebugMode");
if (message == "true")
{
DebugMode = true;
return DebugMode;
}
else {
DebugMode = false;
return DebugMode;
}
}
}
#endregion
}
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment