x


GUI does not contain a definition for Box

Hey guys, I'm a little baffled at why the following code does no compile:

using UnityEngine; using System.Collections;

public class MainTitle : MonoBehaviour {

// Use this for initialization void Start() {

}

// Update is called once per frame void Update() {

}

void OnGUI() { GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "This is a title"); } }

Am I missing something? As far as I'm aware, the GUI class most certainly contains a definition for Box. It's in every tutorial and every example I can find online!

I'm just trying to make a simple GUI for a class assignment. Anyone have any thoughts on why this isn't working? Maybe I need to import something?

Thanks for your help,

Fred

more ▼

asked Oct 18, 2011 at 09:46 PM

Redlazer gravatar image

Redlazer
61 25 18 21

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You have a class of your own somewhere called GUI. It's better not to do that, because then you have to differentiate between your GUI and Unity's GUI. Also, please take 2 seconds and format your code when posting.

more ▼

answered Oct 18, 2011 at 10:03 PM

Eric5h5 gravatar image

Eric5h5
110k 55 181 660

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5798
x67

asked: Oct 18, 2011 at 09:46 PM

Seen: 4418 times

Last Updated: Oct 18, 2011 at 10:05 PM