Search Unity

useGUILayout does not exist

Discussion in 'Immediate Mode GUI (IMGUI)' started by pixelthis, Aug 26, 2010.

  1. pixelthis

    pixelthis

    Joined:
    Nov 5, 2008
    Posts:
    120
    Hi all,

    My script inherits from MonoBehaviour, yet when I use the following:
    Code (csharp):
    1. void Awake(){
    2.     useGUILayout = false;
    3. }
    4.  
    I get this error:
    Code (csharp):
    1. The name `useGUILayout' does not exist in the current context
    Is this a UnityFree vs Professional feature?
     
  2. laurie

    laurie

    Joined:
    Aug 31, 2009
    Posts:
    638
    Nope, it's as the message says; it doesn't exist. What are you trying to do?
     
  3. pixelthis

    pixelthis

    Joined:
    Nov 5, 2008
    Posts:
    120
  4. laurie

    laurie

    Joined:
    Aug 31, 2009
    Posts:
    638
    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?
     
  5. pixelthis

    pixelthis

    Joined:
    Nov 5, 2008
    Posts:
    120
    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.
     
  6. tomvds

    tomvds

    Joined:
    Oct 10, 2008
    Posts:
    1,028
    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:
    Code (csharp):
    1. #if UNITY_IPHONE
    2. useGUILayout = false;
    3. #endif
    That way, the compiler will only include the line when in Unity iPhone.