Skip to content

Commit 2058884

Browse files
authored
Merge pull request #4 from erkerkiii/development
Notes on scene view
2 parents 27dac7a + 007018f commit 2058884

File tree

6 files changed

+45
-5
lines changed

6 files changed

+45
-5
lines changed

Assets/EditorNotes/Editor/EditorNoteInspector.cs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using UnityEditor;
23
using UnityEditor.SceneManagement;
34
using UnityEngine;
@@ -22,11 +23,11 @@ private void OnEnable()
2223

2324
public override void OnInspectorGUI()
2425
{
26+
base.OnInspectorGUI();
27+
2528
InitializeGUIStyle();
2629
CheckNotes();
2730

28-
base.OnInspectorGUI();
29-
3031
if (_note != null)
3132
{
3233
DrawTextArea();
@@ -41,7 +42,25 @@ public override void OnInspectorGUI()
4142
}
4243
}
4344
}
44-
45+
46+
private void OnSceneGUI()
47+
{
48+
if (_note == null)
49+
{
50+
return;
51+
}
52+
53+
string noteContent = _note.content;
54+
55+
Handles.Label(GetTargetGameObject().transform.position, noteContent);
56+
57+
Handles.BeginGUI();
58+
59+
GUILayout.Box(noteContent);
60+
61+
Handles.EndGUI();
62+
}
63+
4564
private void InitializeGUIStyle()
4665
{
4766
if (_guiStyle != null)
@@ -145,9 +164,10 @@ private void SaveNote()
145164
{
146165
return;
147166
}
167+
148168
_note?.Save();
149169
}
150-
170+
151171
private void OnDisable()
152172
{
153173
SaveNote();

Assets/EditorNotes/Editor/EditorNotesWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ private void OnGUI()
3636
{
3737
LoadObjectsWithNotes();
3838
}
39+
3940
}
4041

4142
private void InitializeGUIStyle()

Assets/EditorNotes/Editor/UniqueIdLinkerInspector.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public override void OnInspectorGUI()
2020

2121
if (string.IsNullOrEmpty(_id))
2222
{
23-
SerializedObject serializedObject = new SerializedObject(target);
2423
_id = serializedObject.FindProperty("_id").stringValue;
2524
}
2625

Assets/EditorNotes/EditorNotesFileHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ internal static class EditorNotesFileHandler
1111

1212
public static void Write(string text, string objectUniqueId)
1313
{
14+
if (string.IsNullOrEmpty(objectUniqueId))
15+
{
16+
return;
17+
}
18+
1419
if (!Directory.Exists(DIRECTORY_PATH))
1520
{
1621
try

Assets/Scenes/SampleScene.unity

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ GameObject:
227227
- component: {fileID: 963194228}
228228
- component: {fileID: 963194227}
229229
- component: {fileID: 963194226}
230+
- component: {fileID: 963194229}
230231
m_Layer: 0
231232
m_Name: Main Camera
232233
m_TagString: MainCamera
@@ -299,3 +300,16 @@ Transform:
299300
m_Father: {fileID: 0}
300301
m_RootOrder: 1
301302
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
303+
--- !u!114 &963194229
304+
MonoBehaviour:
305+
m_ObjectHideFlags: 0
306+
m_CorrespondingSourceObject: {fileID: 0}
307+
m_PrefabInstance: {fileID: 0}
308+
m_PrefabAsset: {fileID: 0}
309+
m_GameObject: {fileID: 963194225}
310+
m_Enabled: 1
311+
m_EditorHideFlags: 0
312+
m_Script: {fileID: 11500000, guid: 7f71c2be7e3c58249b46477188f5f010, type: 3}
313+
m_Name:
314+
m_EditorClassIdentifier:
315+
_id: 9ae767009347b6149909599e4ef71715
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Editor notes rocks!

0 commit comments

Comments
 (0)