| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Load Scriptable Objects via code
[CreateAssetMenu(menuName = "Game/Configs/Player")]
public class PlayerConfig : ScriptableObject
{
[SerializeField] private float _startHealth = 100f;
public float StartHealth => _startHealth;
}Now you need to create an asset and put it in Resources folder
public class Player : MonoBehaviour
{
private float _health = 0f;
private void Awake()
{
_health = Storage.Get<PlayerConfig>().StartHealth;
}
}| Back | FazBrowse Home | New Git URL |