Skip to content

Commit 94cbd08

Browse files
committed
fix: warnings on ScriptableObjectSingleon
1 parent 1443813 commit 94cbd08

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Scripts/Runtime/Core/ResourceScriptableObjectSingleton.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public static T LoadOrCreateInstance()
2121
{
2222
if (!TryToLoadInstance(out T resultInstance))
2323
{
24-
#if UNITY_EDITOR
24+
#if !UNITY_EDITOR
25+
return null;
26+
#else
2527
resultInstance = CreateInstance<T>();
2628

2729
AssetDatabaseUtils.CreatePathIfDontExist("Assets/Resources");
@@ -30,18 +32,17 @@ public static T LoadOrCreateInstance()
3032
UnityEditor.AssetDatabase.Refresh();
3133
return resultInstance;
3234
#endif
33-
return null;
3435
}
3536

3637
return resultInstance;
3738
}
3839

3940
public static bool Exist()
4041
{
41-
return TryToLoadInstance<T>(out _);
42+
return TryToLoadInstance(out _);
4243
}
4344

44-
private static bool TryToLoadInstance<T>(out T result) where T : ScriptableObject
45+
private static bool TryToLoadInstance(out T result)
4546
{
4647
T newInstance = Resources.Load<T>(typeof(T).Name);
4748

0 commit comments

Comments
 (0)