Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

What can be exposed in the Inspector?

Discussion in 'Editor & General Support' started by RockHound, Jul 6, 2006.

  1. RockHound

    RockHound

    Joined:
    Apr 14, 2006
    Posts:
    132
    I defined the following public member variable in JavaScript...

    Code (csharp):
    1. var Bounds : Rect;
    2.  
    but it does not show up in the inspector. What types can or cannot be exposed in the Inspector?

    Thank you.
     
  2. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,271
    You can only expose primitive data types, I believe. What are you trying to do? Would it not work to just expose some of the object variables like Rect.width and Rect.height?
     
  3. RockHound

    RockHound

    Joined:
    Apr 14, 2006
    Posts:
    132
    Thanks for your reply Marble. I would like to expose a Rect object in the inspector, much like a view port is exposed from the Camera component, or pixel inset is exposed from the GUITexture component. This is a more convenient use of code and Inspector real estate than exposing each Rect member.

    Since it appears that I can't, I will take your suggestion and expose the individual elements.

    However, my question is more general. Atomic types can be exposed, as can classes inherting from Object, I think. But rather than experimenting or guessing, I was hoping that someone who knew could simply state exactly what can and cannot be exposed.

    Thanks again, Marble, for your advice.
     
  4. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Rect should show up in the inspector, it's just an (already reported) bug that it doesn't. More than just atomic variables show up in the inspector. (Vector3, Quaternion, etc) If you need a Rect in your script, you can always write your own Rect class and have that show up in the inspector. Just stick the [System.Serializable] attribute on the class.

    Like is done in the C# example of this: http://unify.bluegillweb.com/scriptwiki/index.php?title=Button