File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -4,22 +4,25 @@ Load Scriptable Objects via code
4
4
## Usage
5
5
6
6
### Creating ScriptableObject:
7
+ Your ``` ScriptableObject ``` must implement ``` ILoadable ``` interface.
7
8
8
9
``` csharp
9
10
[CreateAssetMenu (menuName = " Game/Configs/Player" )]
10
- public class PlayerConfig : ScriptableObject
11
+ public class PlayerConfig : ScriptableObject , ILoadable
11
12
{
12
13
[SerializeField ] private float _startHealth = 100 f ;
13
14
14
15
public float StartHealth => _startHealth ;
15
16
}
16
17
```
17
18
18
- Now you need to create an asset and put it in Resources folder
19
+ Now you need to create an asset.
19
20
20
21
### Get Data from ScriptableObject:
21
22
22
23
``` csharp
24
+ using ToolBox .Loader ;
25
+
23
26
public class Player : MonoBehaviour
24
27
{
25
28
private float _health = 0 f ;
You can’t perform that action at this time.
0 commit comments