Indirect Reference
7_ScriptableSubAssets
Last updated
7_ScriptableSubAssets
Last updated
If you select PowerUp Gameobject in the hierarchy, you can see that it has a HealthPowerUp component attached to it.
This component references the scriptable object wrapper (PlayerStats), as opposed to directly referencing the Health ScriptableVariable. If you check the code for this component, you see how to access the Health indirectly:
This can be useful. For example, if you need to access multiple sub-assets of the same wrapper in a class. If you press Play and move the player into the power up, it will heal the player.