Skip to content

Instantly share code, notes, and snippets.

@kinifi
Created September 8, 2016 23:33
Show Gist options
  • Save kinifi/162b0520e1c1db51b4d47a3f562714e0 to your computer and use it in GitHub Desktop.
Save kinifi/162b0520e1c1db51b4d47a3f562714e0 to your computer and use it in GitHub Desktop.
Boilerplate for creating a unity window extension. Must be located in a folder called "Editor"
/*
* Must be located in a folder called "Editor"
* Note: the %l is the shortcut for opening this window in unity. % = Alt/CMD button
*/
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Assertions;
public class EditorWindowExtension : EditorWindow
{
[MenuItem("Window/Language Editor %l")]
public static void ShowEditor()
{
//create the editor window
EditorWindowExtension editor = EditorWindow.GetWindow<EditorWindowExtension>();
//the editor window must have a min size
editor.titleContent = new GUIContent("Editor");
editor.minSize = new Vector2 (600, 400);
//call the init method after we create our window
editor.Init();
}
private void Init()
{
}
private void OnGUI()
{
}
//UNITY EVENTS START
public void PlaymodeChanged()
{
Repaint();
}
public void OnLostFocus ()
{
Repaint();
}
public void OnFocus()
{
Repaint();
}
public void OnProjectChange ()
{
Repaint();
}
public void OnSelectionChange ()
{
Repaint();
}
//UNITY EVENTS END
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment