Skip to content

Commit 470f9cd

Browse files
authored
Update and rename Config.cs to Storage.cs
1 parent c981b17 commit 470f9cd

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

Config.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

Storage.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using UnityEngine;
2+
3+
public static class Storage
4+
{
5+
private static ScriptableObject[] _assets = null;
6+
7+
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
8+
private static void Load() =>
9+
_assets = Resources.LoadAll<ScriptableObject>("");
10+
11+
public static T Get<T>() where T : ScriptableObject
12+
{
13+
for (int i = 0; i < _assets.Length; i++)
14+
if (_assets[i] is T asset)
15+
return asset;
16+
17+
return null;
18+
}
19+
}

0 commit comments

Comments
 (0)