How do I add info for variables in the inspector?

Built-in inspector fields have info that shows up at the bottom of the Unity window when you mouse over them. Is there any way to support this with arbitrary Javascripts? I’m writing scripts that someone else is going to be using, and an info string for each var would help a lot.

Any typed public variable of a script will show up in the inspector. For example:

var xChange : int = 1.0;

function Update() {
transform.position += Vector3(xChange*Time.deltaTime, 0, 0);
}

You’ll see an “X Change” field you can edit.
This doesn’t work on all types. IT does:
int
String
float
Vector2,3,4
Color
enumerations*
Classes*
builtin arrays*
references to a GameObject or any Component

*For some reason, these types are limited - if you have an array of instances of a custom class, you cannot edit the individual items; arrays of enums will show up as their integer counterpart instead of the usual dropdown boxes. Also, while you can edit builtin arrays to your heart’s desire, the “Array” class cannot be edited in the inspector.

I think the question is about the “tooltip” (not really a tooltip since it shows up at the bottom of the window) info that you get with certain items. Like if you hover the pointer over the Radius item in a sphere collider, for example, you get info that says “The radius of the sphere. [ .00001, infinity ].”

I don’t think there’s a way to add that kind of info for user variables, unfortunately. Nifty idea though. I guess the thing to do is make sure all the variables are well-commented, since you can double-click the script from anywhere and it will pop up in Unitron or whatever, though that’s not quite as convenient obviously.

–Eric

http://forum.unity3d.com/viewtopic.php?t=832

:slight_smile:

-Jon

Oh, my bad. Misread that. :slight_smile: