I've got a script which creates raycasts. I wanted to use the (presumably less expensive) Plane.Raycast rather than the GameObject.Collider.Raycast (because the gameobject one has a distance parameter so that's one more check)

I can expose the plane gameobject in my scene easily by simply making a public gameobject variable like this:

public GameObject floor;

however when I turn it into this:

public Plane floor;

It doesn't expose in the scene. Why is this?

  • 1
    \$\begingroup\$ Same thing happened to me yesterday. The Plane struct isn't the game thing as a GameObject Plane; it's a geometric representation of a plane used for math calculations. Plane docs. \$\endgroup\$
    – Wackidev
    May 19, 2012 at 16:25

1 Answer 1


It's because the only things that show up in the inspector are serializable fields or things that you implement in OnInspectorGUI as a custom editor for that class.

For reference: http://unity3d.com/support/documentation/ScriptReference/SerializeField

Serializable types are:

  • All classed inheriting from UnityEngine.Object, for example Gameobject, Commponent, MonoBehaviour, Texture2D, AnimationClip..
  • All basic data types like int, string, float, bool.
  • Some built in types like Vector2, Vector3, Vector4, Quaternion, Matrix4x4, Color, Rect, Layermask...
  • Arrays of a serializable type
  • List of a serializable type (new in Unity2.6)
  • Enums

Headsup note: if you put one element in a list (or array) twice, when the list gets serialized, you'll get two copies of that element, instead of one copy being in the new list twice.

Now Plane is just a struct that has a Vector3 and a float, so you could use those two serializable types to construct a Plane object at runtime if you really need to.

But my guess is that you really want to leave the serialized field as GameObject so you can point to the plane in the scene.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .