J's Study log

[Unity] Pubilc 본문

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.

'Computer Language > Unity' 카테고리의 다른 글

[Unity] Time.deltaTime  (0) 2019.03.06
[Unity] UI  (0) 2019.03.06
[Unity] Tag / Applied Learning(Eating Coins, Game Manager)  (0) 2019.03.04
[Unity] Trigger and Collision  (0) 2019.03.02
[Unity] Local Transform  (0) 2019.02.27
Comments