ModifyPlayerData

The following script can be added to PlayerStats ( or any gameObject in a scene) To provide a way to configure a UI Button in the Inspector Panel to modify GameData Score or Health. It's necessary to use a helper script like this since GameData is a singleton and therefore is not available as a gameObject in any scene other than BeginScene, to configure calling public methods to change GameData values.

PlayerStats Prefab: UpdateText: Note: I have added a new UI-Text field to PlayerStats Prefab to display text to indicate when data's been updated.

Last updated

Was this helpful?