can someone help me understand why I can’t get my window object to be created when I click on it in the create menu?
I currently get the warning “you are trying to create a MonoBehaviour using the ‘new’ keyword This is not allowed.”
but when make my window not inherit monobehaviour it doesn’t do anything.
this is my current code…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tizen;
using UnityEditor;
public class Menu : MonoBehaviour {
[MenuItem ("GameObject/UI/Window")]
private static void CreateWindowObject()
{
Window window = new Window();
}
}
public class Window : MonoBehaviour {
public GUISkin skin = null;
public Rect rect = new Rect(15, 15, 250, 250);
private void OnGUI()
{
GUI.skin = skin;
rect = GUI.Window(0, rect, OnWindow, "MyWindow");
}
private void OnWindow(int id)
{
}
}