I am trying to make my GUI creation somewhat easier and learn about it in the same time. I dont want to buy or use a third party plugin.
I am trying to make a button script that i can use overall, i have so far made it to this:
using UnityEngine;
using System.Collections;
[ExecuteInEditMode()]
public class SceneBTN : MonoBehaviour {
public GUIStyle myGui;
public int theHeight = 50;
public int theWidth = 200;
public float verticalPlacement = 50;
public string buttonText = "Button Text";
void OnGUI() {
Rect BTNtext = new Rect(Screen.width / 2 - (theWidth / 2), Screen.height - verticalPlacement, theWidth, theHeight);
GUI.Label(BTNtext, buttonText, myGui);
}
void OnMouseEnter() {
print("test");
}
}
When i try to OnMouseEnter i am expecting to get a print of test in the console but nothing shows up.
I guess i am missing something very fundamental and since i have found great help on stackoverflow i turn to you guys once again (you're great by the way).
Here is a screenshot:
