Editor Notes system with int, float, vec3, string, and gameobject references
This commit is contained in:
parent
fee524fe19
commit
62c2dce8c9
7 changed files with 130 additions and 0 deletions
67
EditorNotes/EditorNote.cs
Normal file
67
EditorNotes/EditorNote.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace gay.lilyy.EditorNotes {
|
||||
|
||||
public class EditorNote : MonoBehaviour, IEditorOnly
|
||||
{
|
||||
public enum ValueType { Int, Float, Vector3, String, All, None }
|
||||
|
||||
public ValueType valueType = ValueType.Int;
|
||||
|
||||
public int intValue;
|
||||
public float floatValue;
|
||||
public Vector3 vector3Value;
|
||||
|
||||
public string stringValue;
|
||||
|
||||
[TextArea]
|
||||
public string note;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
[CustomEditor(typeof(EditorNote))]
|
||||
public class EditorNoteInspector : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var script = (EditorNote)target;
|
||||
|
||||
script.valueType = (EditorNote.ValueType)EditorGUILayout.EnumPopup("Type", script.valueType);
|
||||
|
||||
switch (script.valueType)
|
||||
{
|
||||
case EditorNote.ValueType.Int:
|
||||
script.intValue = EditorGUILayout.IntField("Int Value", script.intValue);
|
||||
break;
|
||||
case EditorNote.ValueType.Float:
|
||||
script.floatValue = EditorGUILayout.FloatField("Float Value", script.floatValue);
|
||||
break;
|
||||
case EditorNote.ValueType.Vector3:
|
||||
script.vector3Value = EditorGUILayout.Vector3Field("Vector3 Value", script.vector3Value);
|
||||
break;
|
||||
case EditorNote.ValueType.String:
|
||||
script.stringValue = EditorGUILayout.TextField("String Value", script.stringValue);
|
||||
break;
|
||||
}
|
||||
if (script.valueType == EditorNote.ValueType.All) {
|
||||
script.intValue = EditorGUILayout.IntField("Int Value", script.intValue);
|
||||
script.floatValue = EditorGUILayout.FloatField("Float Value", script.floatValue);
|
||||
script.vector3Value = EditorGUILayout.Vector3Field("Vector3 Value", script.vector3Value);
|
||||
script.stringValue = EditorGUILayout.TextField("String Value", script.stringValue);
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField("Note");
|
||||
script.note = EditorGUILayout.TextArea(script.note);
|
||||
|
||||
if (GUI.changed)
|
||||
EditorUtility.SetDirty(script);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue