I know I am very frequent with my questions, but I have figured out pretty much everything except GUI scripting. I have reviewed the basics that Unity provides, but my code will never render correctly. If anyone can give me a detailed tutorial about how to write out a main menu GUI, or if anyone can write a GUI script for me, I would really appreciate it. I keep getting an error message with my code, which I will copy and paste below. The error code is BCE0023 "No appropriate version of Unityengine.GUI.Button for the string wasn’t found. IDK if anyone can help me with this. Thanks in advance.
Oh my apologies. The method I attempted was GUI layout simply because the position can be edited within UNITY rather than using coordinate based positioning. My code is as follows:
var text: String = "Hello World";
var area: Rect;
function OnGUI() {
GUILayout.BeginArea(area);
GUILayout.BeginVertical("box");
if (GUILayout.Button("Answer1")) {
Debug.Log("Yes");
}
if (GUILayout.Button("Answer2")) {
Debug.Log("No");
}
GUILayout.EndVertical();
GUILayout.EndArea();
}
Obviously it isn’t what my menu is going to contain, it was simply a practice to get used to the scripting of GUI. This was more of a template I was planning to work off of. Any help as to why I am getting a compiler error regarding the error code above would be appreciated.