Having Text Or Notes In The Inspector?

Is there a way(like I see in many plug-ins) to have text or notes in the inspector amongst all the variables? For example I have a couple of lines of text above of variable to remind people what options they have for this variable?

Thanks In Advance!

I think you just mean the built in Attributes Unity have already set up?

See

and

Example code snippet:

[Header("Button Settings")]
[Tooltip("Arbitary text message")]
public string OnClickText = "";
[Tooltip("Useful GameObject you might need.  Note there is a Sender property that is this class.")]
public GameObject Object;

For a general note on the component, create a new variable that has a [TextArea] Attribute.

[TextArea]
[Tooltip("Doesn't do anything. Just comments shown in inspector")]
public string Notes = "This component shouldn't be removed, it does important stuff.";

I realize this question is a few years old but I was recently looking to do the same and didn’t like the dummy variable suggestion, so I wrote my own really simple PropertyDrawer and HelpAttribute. More information at the forum post:

https://forum.unity3d.com/threads/helpattribute-allows-you-to-use-helpbox-in-the-unity-inspector-window.462768/

Hope this helps someone out who is still looking for a more elegant solution.

FAST

  1. Make a C# script: CommentInformationNote
  2. Copy and past this code
using UnityEngine;

[AddComponentMenu("Miscellaneous/README Info Note")]
public class CommentInformationNote : MonoBehaviour
{
    [TextArea(10,1000)]
    public string Comment = "Information Here.";
}

*. Place the script into the game object
*. Notice that you can use Add Component in the Inspector.
*. Do not change the script because you can loos all your data
*. DONE


ALTERNATIVE

After adding attributes to your script as MasterChiefLegend mention, you can create text notes in the inspector following these steps:

Here it is the GitHub link:

Allowed to place info in the inspector in a simple way:

[CustomEditor(typeof(YourType))] is what you’re looking for.

GUILayout.Label("Remember that one thing about this variable!");
x = EditorGUILayout.IntField(whatever);

Similar to ShawnFeatherly, I use a custom [ReadOnlyAttribute] tag. It has a similar effect, but is non-editable and inline.

[ReadOnlyAttribute]
[SerializeField]
private new string Notes = "Don't forget to buy milk.";

Note that ReadOnlyAttribute is an extension that you have to manually add to your project