useGUILayout does not exist

Hi all,

My script inherits from MonoBehaviour, yet when I use the following:

void Awake(){
	useGUILayout = false;
}

I get this error:

The name `useGUILayout' does not exist in the current context

Is this a UnityFree vs Professional feature?

Nope, it’s as the message says; it doesn’t exist. What are you trying to do?

I’m trying to set useGUILayout to false :slight_smile:

MonoBehaviour.useGUILayout from the reference manual

Oops, my appologies; I’ve never come across that before. Hmm, unless it’s a 3.0-ism that’s leaked out early, it should work. Are you sure your script is derived from MonoBehaviour?

Yup, positive.

It’s mentioned in a couple of places, mostly relating to Unity iPhone, so perhaps it is a specific feature of Unity iPhone.

Unity iPhone is my eventual target, but I like to develop on my PC so I use UnityFree on my PC, and then transfer to Mac to build it.

I’ll check it out.

Yes, it’s iPhone specific. This will presumably be fixed once Unity 3 will come out. Until then, if you’re using C#, you can use it like this:

#if UNITY_IPHONE
useGUILayout = false; 
#endif

That way, the compiler will only include the line when in Unity iPhone.