Computer Language/Unity

[Unity] Pubilc

정우섭 2019. 3. 6. 22:37

To use script A's function in script B. You have to declare function as public function like this.



And now you can use RestartGame() in other scripts. Funny thing to know that when you declare a variable public you can see it in Inspector.



You can see Coin Count and also you can change the value in real time. Just like I said, because you can change the value in real time, you should reset value in Start() function.