How to use the same script on multiple game objects in unity?

后端 未结 2 894
情深已故
情深已故 2021-01-24 01:56

I have a script CoinFill which makes a radial progress bar.

When the FillAmount = 1 I want to reset that specific Image to zero. I want to be able to use t

2条回答
  •  余生分开走
    2021-01-24 02:56

    Joe's answer is good, but wanted to add another option to answer the titular question: Since your class derives from Monobehavior, you can add your script to ANY game object at Run-time with the following code-line.

    someobject.gameObject.AddComponent();
    

提交回复
热议问题