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
8
EditorNotes.meta
Normal file
8
EditorNotes.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b46f5926760e80147ae27026dcffc881
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
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
|
||||
|
||||
}
|
||||
11
EditorNotes/EditorNote.cs.meta
Normal file
11
EditorNotes/EditorNote.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 353cc3d6f30a43a4689be04e919b90f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
EditorNotes/EditorNotes.asmdef
Normal file
16
EditorNotes/EditorNotes.asmdef
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "EditorNotes",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:3456780c4fb2d324ab9c633d6f1b0ddb"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
EditorNotes/EditorNotes.asmdef.meta
Normal file
7
EditorNotes/EditorNotes.asmdef.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a65a5779a3702144986d83fca255f5da
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
EditorNotes/GameObjectReference.cs
Normal file
10
EditorNotes/GameObjectReference.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
namespace gay.lilyy.EditorNotes {
|
||||
public class GameObjectReference : MonoBehaviour, IEditorOnly
|
||||
{
|
||||
public GameObject gObject;
|
||||
[TextArea]
|
||||
public string note;
|
||||
}
|
||||
}
|
||||
11
EditorNotes/GameObjectReference.cs.meta
Normal file
11
EditorNotes/GameObjectReference.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 62a8eeb35a66e0f468016f12604da829
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue