I’m just trying to make a window pop up from the Menu when clicking ‘Open’ but I get a null reference exception saying: Object reference not set to an instance of an object.
The code builds fine:
using UnityEngine;
using System.Collections;
using UnityEditor;
public class FFToolKit : MonoBehaviour {
// Use this for initialization
public string[] toolbarStrings = new string[] { "File", "View", "Edit" };
public int toolbarInt = 0;
void Start () {
}
// Update is called once per frame
void Update () {
}
[MenuItem("FFToolKit/Open")]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(FFToolKit));
}
void OnGui()
{
toolbarInt = GUI.Toolbar(new Rect(5,5, 100, 20),toolbarInt, toolbarStrings);
}
}
Any ideas as to where I’ve gone wrong?