Skip to content

Commit

Permalink
Added more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanMurzak committed Jul 26, 2024
1 parent ec46d85 commit 42d4ea6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Assets/_PackageRoot/Scripts/Binders/BaseColorBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,17 @@ protected virtual void TrySetColor(ThemeData theme)
private void OnValidate()
{
// Attaching to first color
if (string.IsNullOrEmpty(data.colorGuid) || Theme.Instance?.ColorGuids.Contains(data.colorGuid) == false)
if (string.IsNullOrEmpty(data.colorGuid))
{
if (Theme.Instance?.debugLevel <= DebugLevel.Error)
Debug.LogError($"colorGuid is null at: <b>{GameObjectPath()}</b>. Taking the first one available.", gameObject);
data.colorGuid = Theme.Instance?.GetColorFirst().Guid;
}
if (!data.IsConnected)
{
if (Theme.Instance?.debugLevel <= DebugLevel.Error)
Debug.LogError($"colorGuid is null or doesn't match to any existed colors at: <b>{GameObjectPath()}</b>", gameObject);
Debug.LogError($"colorGuid='{data.colorGuid}' doesn't match to any existed colors at: <b>{GameObjectPath()}</b>. Taking the first one available.", gameObject);
data.colorGuid = Theme.Instance?.GetColorFirst().Guid;
}

TrySetColor(Theme.Instance.CurrentTheme);
Expand Down
4 changes: 3 additions & 1 deletion Assets/_PackageRoot/Scripts/Config/Theme.Singleton.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using UnityEngine;

namespace Unity.Theme
Expand All @@ -14,6 +13,9 @@ public static Theme Instance
if (instance == null)
instance = GetOrCreateInstance();

if (instance == null)
Debug.LogError("Theme instance is null");

return instance;
}
}
Expand Down
3 changes: 3 additions & 0 deletions UserSettings/EditorUserSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedSceneGuid-0:
value: 02550c0754015e035c5c582448750b444116487b2f7173672e2a1b37b3e6663d
flags: 0
RecentlyUsedSceneGuid-1:
value: 0000555401055f080856587613250e444e164d7d2d79773478284e30e3b8646d
flags: 0
RecentlyUsedScenePath-0:
Expand Down

0 comments on commit 42d4ea6

Please sign in to comment.