mardi 9 octobre 2018

Access to the variable between multiple scripts for loose coupling in Unity3D

For instance, assume we have a health variable in one script and want to access to this variable in UI script for showing health and on the other hand change pitch of sound according to amount of health. I know some ways to access this variable but they highly dependent scripts to each other. Like GetComponent, Singelton or even C# event. I want to know is there any patterns to decrease these dependencies ? (Also efficient and performant)

Aucun commentaire:

Enregistrer un commentaire