Skip to content

Commit 39b7ef0

Browse files
committed
fixes
1 parent 07d7791 commit 39b7ef0

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

Editor/NoteUtility.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ private static void DrawNote(Note note, GizmoType gizmoType)
140140

141141
if (note.DrawIcon)
142142
{
143-
Gizmos.DrawIcon(note.transform.position, _authorNoteIconPath, false, note.Author.color);
144-
Gizmos.DrawIcon(note.transform.position, _typeNoteIconPath, false, note.Type.color);
143+
Gizmos.DrawIcon(note.transform.position, _authorNoteIconPath, false, note.AuthorColor);
144+
Gizmos.DrawIcon(note.transform.position, _typeNoteIconPath, false, note.Color);
145145
}
146146
}
147147
private static void DrawWorldLabel(INote note, Vector3 position, GUIContent content, GUIStyle style)

Editor/NotesSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace DCFApixels.Notes.Editors
88
{
99
using static NotesConsts;
1010
[FilePath(AUTHOR + "/NotesSettings", FilePathAttribute.Location.ProjectFolder)]
11+
[InitializeOnLoad]
1112
internal class NotesSettings : ScriptableSingleton<NotesSettings>, ISerializationCallbackReceiver
1213
{
1314
internal const int NO_INIT_ID = 0;
@@ -47,7 +48,9 @@ public bool TryGetAuthorInfo(int id, out AuthorInfo info)
4748
public AuthorInfo GetAuthorInfoOrDummy(int id)
4849
{
4950
if (TryGetAuthorInfo(id, out var result))
51+
{
5052
return result;
53+
}
5154
return DUMMY_AUTHOR;
5255
}
5356

@@ -65,7 +68,9 @@ public bool TryGetTypeInfo(int id, out NoteTypeInfo info)
6568
public NoteTypeInfo GetNoteTypeInfoOrDummy(int id)
6669
{
6770
if (TryGetTypeInfo(id, out var result))
71+
{
6872
return result;
73+
}
6974
return DUMMY_NOTE_TYPE;
7075
}
7176

Runtime/LazyNote.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public Color Color
4848
#if UNITY_EDITOR
4949
return _color;
5050
#else
51-
return default;
51+
return Color.black;
5252
#endif
5353
}
5454
}

Runtime/Note.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public AuthorInfo Author
6868
get
6969
{
7070
#if UNITY_EDITOR
71-
if (_author.IsNullOrDummy() == false) UpdateRefs();
71+
if (_author == null) { UpdateRefs(); }
7272
return _author;
7373
#else
7474
return null;
@@ -87,7 +87,7 @@ public NoteTypeInfo Type
8787
get
8888
{
8989
#if UNITY_EDITOR
90-
if (_type.IsNullOrDummy() == false) UpdateRefs();
90+
if (_type == null) { UpdateRefs(); }
9191
return _type;
9292
#else
9393
return null;
@@ -113,14 +113,25 @@ public bool DrawIcon
113113
}
114114
}
115115

116+
public Color AuthorColor
117+
{
118+
get
119+
{
120+
#if UNITY_EDITOR
121+
return Author.color;
122+
#else
123+
return Color.black;
124+
#endif
125+
}
126+
}
116127
public Color Color
117128
{
118129
get
119130
{
120131
#if UNITY_EDITOR
121132
return Type.color;
122133
#else
123-
return default;
134+
return Color.black;
124135
#endif
125136
}
126137
}

0 commit comments

Comments
 (0)