Skip to content

Commit

Permalink
Merge pull request #4 from erkerkiii/development
Browse files Browse the repository at this point in the history
Notes on scene view
  • Loading branch information
erkerkiii committed Oct 24, 2021
2 parents 27dac7a + 007018f commit 2058884
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
28 changes: 24 additions & 4 deletions Assets/EditorNotes/Editor/EditorNoteInspector.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
Expand All @@ -22,11 +23,11 @@ private void OnEnable()

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

InitializeGUIStyle();
CheckNotes();

base.OnInspectorGUI();

if (_note != null)
{
DrawTextArea();
Expand All @@ -41,7 +42,25 @@ public override void OnInspectorGUI()
}
}
}


private void OnSceneGUI()
{
if (_note == null)
{
return;
}

string noteContent = _note.content;

Handles.Label(GetTargetGameObject().transform.position, noteContent);

Handles.BeginGUI();

GUILayout.Box(noteContent);

Handles.EndGUI();
}

private void InitializeGUIStyle()
{
if (_guiStyle != null)
Expand Down Expand Up @@ -145,9 +164,10 @@ private void SaveNote()
{
return;
}

_note?.Save();
}

private void OnDisable()
{
SaveNote();
Expand Down
1 change: 1 addition & 0 deletions Assets/EditorNotes/Editor/EditorNotesWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ private void OnGUI()
{
LoadObjectsWithNotes();
}

}

private void InitializeGUIStyle()
Expand Down
1 change: 0 additions & 1 deletion Assets/EditorNotes/Editor/UniqueIdLinkerInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public override void OnInspectorGUI()

if (string.IsNullOrEmpty(_id))
{
SerializedObject serializedObject = new SerializedObject(target);
_id = serializedObject.FindProperty("_id").stringValue;
}

Expand Down
5 changes: 5 additions & 0 deletions Assets/EditorNotes/EditorNotesFileHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ internal static class EditorNotesFileHandler

public static void Write(string text, string objectUniqueId)
{
if (string.IsNullOrEmpty(objectUniqueId))
{
return;
}

if (!Directory.Exists(DIRECTORY_PATH))
{
try
Expand Down
14 changes: 14 additions & 0 deletions Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ GameObject:
- component: {fileID: 963194228}
- component: {fileID: 963194227}
- component: {fileID: 963194226}
- component: {fileID: 963194229}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -299,3 +300,16 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &963194229
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7f71c2be7e3c58249b46477188f5f010, type: 3}
m_Name:
m_EditorClassIdentifier:
_id: 9ae767009347b6149909599e4ef71715
1 change: 1 addition & 0 deletions EditorNotes/9ae767009347b6149909599e4ef71715.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Editor notes rocks!

0 comments on commit 2058884

Please sign in to comment.