Updated # 2023
FAST WAY
- Make a C# script: CommentInformationNote
- Copy and paste this code.
#if UNITY_EDITOR
using UnityEngine;
/* **************************************************************************
* 2023 Alan Mattanó, Soaring Stars lab }}
*
* Overall, this script allows you to add notes
* or comments to GameObjects in the Unity Editor,
* making it easier to communicate essential information
* about GameObjects or their components to other developers
*
* WARNING: DO NOT MODIFY
* you will lose all data
*
* By wrapping the script inside the #if UNITY_EDITOR directive,
* it will only be compiled and executed in the Unity Editor.
* When you build your project, the script will be excluded from the build,
* and it won't impact the final game. It may need to add using UnityEditor;
* at the beginning of the script if you encounter any issues with the
* #if UNITY_EDITOR directive.
* ************************************************************************/
[AddComponentMenu("Miscellaneous/README Info Note")]
public class CommentInformationNote : MonoBehaviour
{
[TextArea(17,1000)]
public string comment = "Information Here.";
void Awake()
{
comment = null;
// Assuming you want to destroy this script component
Destroy(this);
}
}
#endif
- 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 lose all your data.
- DONE
By wrapping the script inside the #if UNITY_EDITOR directive, it will only be compiled and executed in the Unity Editor. When you build your project, the script will be excluded from the build and won’t impact the final game.
Note that comment = null since it is not necessary for this purpose.
Remember that you may need to add using UnityEditor; at the beginning of the script if you encounter any issues with the #if UNITY_EDITOR directive.
------------------------------------------------------------------------------------------------------------------------------
Update # 2019
_*https://www.youtube.com/watch?v=YYk6Xg3An6s*_
Update # 2018
Now on GitHub: Unity Inspector Info Text Note
Allows creating info text notes into the inspector.
Just drag and drop the script InspectorNote.cs or find it in the component > miscellaneous > Inspector Text Info Note section.
--------------------------------------------------------------------------------------------------------------------------------------
Update # 2017.
You can start adding a title note to the script that includes important information. It will be visible in the inspector by using new Unity functions as for example:
System.Collections.Generic;
public class YourScriptName: MonoBehaviour
{
[Space]
[Header(" INSPECTOR TITLE NOTE ")]
[Space]
[Header("Second line note explanation shown in inspector")]
[Space(25)]
public bool mybool;
[Space]
[Header("OUTPUTS")]
[Space]
[Tooltip("This is a pop up note hovering over the var in inspector")]
public float myInputFloat;
[Space]
[Header("INPUTS")]
[Space]
public bool myOutputBool = true;
void Start ()
{
}
}
--------------------------------------------------------------------------------------------------------------------------------------
Asset # 2016.
Now, a beter way, is to download a better fantastic tool at:
*Unity Asset Store - The Best Assets for Game Making
Inspector Notes: add text notes to your GameObjects.
Is it a .dll but is much stable, simple and faster._
--------------------------------------------------------------------------------------------------------------------------------------
Learning C# 2014.
For adding simple information, version, info into your Inspector, including warnings attentions etc… I made this code.
I ask Unity in the feedback zone the ability to read notes in the inspector panel. In case you want to vote.
And a Wiki section answering to the question: Adding notes to the inspector? So you can improve my code.
First, make a C# file name “InfoTextNote” open Mono and add this script.
```
*using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/***************************************************
- This file let you add text into the inspector
- has a 2° reference file in Assets “Editor” folder,
- name: AddInspectorText
**************************************************/
public class InfoTextNote : MonoBehaviour
{
public bool isReady = true;
public string TextInfo = "Text here... " +
"/n Press Lock when finish.";
public void SwitchToggle ()
{
isReady = !isReady;
}
void Start ()
{
this.enabled = false; // Disable thi component when game start
}
}
_*_ <em>_*Then make a "Editor" folder and a new C# file name AddInspectorText.*_</em> <em>_*Now add this code into it:*_</em> _*
*_
*using UnityEngine;
using System.Collections;
using UnityEditor;
/* AlanMattano}}2014*/
[CustomEditor(typeof(InfoTextNote))]
public class AddInspectorText : Editor {
private int c = 0;
private string buttonText = "Start typing";
private int MaxSizeInt = 5;
private int[] IntArray = new int[] { 0, 1, 2, 3, 4 };
private string[] MaxSizeString = new string[] { "Line Label", "Box Text ", "Box Info", "Box Warning", "Box Error" };
public override void OnInspectorGUI()
{
InfoTextNote inMyScript = (InfoTextNote)target;
if ( inMyScript.TextInfo == "Start writting text here... " +
"/n Press Lock when finish." )
ShowLogMessage() ;// se podria agregar alguna funcin en especial
if ( !inMyScript.isReady ) {
//DrawDefaultInspector();// Unity function
switch (MaxSizeInt)
{
case 0:
if (EditorGUILayout.Toggle(inMyScript.isReady)) inMyScript.SwitchToggle(); // Toggle
EditorGUILayout.LabelField(inMyScript.TextInfo); // A small line text
break;
case 1:
if ( GUILayout.Button(buttonText)) inMyScript.SwitchToggle(); //
EditorGUILayout.HelpBox(inMyScript.TextInfo, MessageType.None); // This is a small box
break;
case 2:
if ( GUILayout.Button(buttonText)) inMyScript.SwitchToggle(); //
EditorGUILayout.HelpBox(inMyScript.TextInfo, MessageType.Info); // This is a help box
break;
case 3:
if ( GUILayout.Button(buttonText)) inMyScript.SwitchToggle();
EditorGUILayout.HelpBox(inMyScript.TextInfo, MessageType.Warning);// This is a Warning box
break;
case 4:
if ( GUILayout.Button(buttonText)) inMyScript.SwitchToggle(); //
EditorGUILayout.HelpBox(inMyScript.TextInfo, MessageType.Error); // This is a Error box
break;
default:
if ( GUILayout.Button(buttonText)) inMyScript.SwitchToggle(); // Button
EditorGUILayout.HelpBox(inMyScript.TextInfo, MessageType.Info); // This is a help box
break;
}
}else{
//DrawDefaultInspector();// for debug
buttonText = "Lock !";
// Button
if ( GUILayout.Button(buttonText)) inMyScript.SwitchToggle();
// Text
inMyScript.TextInfo = EditorGUILayout.TextArea (inMyScript.TextInfo);
// selection
MaxSizeInt = EditorGUILayout.IntPopup("Text Type :", MaxSizeInt, MaxSizeString, IntArray);
// warning
EditorGUILayout.HelpBox( " Press LOCK at the top when finish. ", MessageType.Warning); // A Warning box
}
}
void ShowLogMessage() {
c++;
if (c==1) {
Debug.Log (" Need to add text " + "\n");
}
}
}
_```_
Now you are ready!
*In the inspector click Add Component and the type : info, text or note and select the script the script InfoTextNote each time you need it!*
[/SIZE][/FONT]
Hope it help you.
*Place make me know if you improve this code.*
[/SIZE][/FONT]
_[/I][/I]*_