I'm creating a game that have multiples references to scripts, one to another.
For exemple:
My doubt enter when I can do two different things:
Which one is better?
In the Scripts that you will only have one of you can set a public static variable in that class with a public get and private set. On the Start or Awake function you set that variable to this and then you can access that script easily from any other scripts.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.