title: How to use the same script on multiple game objects in unity?
body: <p>I have a script <code>CoinFill</code> which makes a radial progress bar.</p>
  
  <p>When the FillAmount = 1 I want to reset that specific Image to zero.  I want to be able to use this for multiple <code>GameObject</code>s. The problem is that when the first <code>FillAmount</code>=1, the penny which speed is faster, you can click on the nickle, which may be at 50% fill and then the penny will reset to 0.  However if the nickle is at 1 it will not reset itself, only the penny will rest.</p>
  
  <p>Image of what I am trying to do:
  <a href="https://i.stack.imgur.com/8IrZf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8IrZf.png" alt="enter image description here"></a></p>
  
  <p>Code:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using UnityEngine.UI;
  
  public class CoinFill : MonoBehaviour {
  
      public SavingsAccountManager sam;
  
      public float fillCoinSpeed;
      public Image coinFill;
      public float maxCoinFill = 100f;
      public float minCoinFill = 0f;
      public float currentCoinFill;
  
  
      // Use this for initialization
      void Start()
      {
          currentCoinFill = minCoinFill;
      }
  
  
      void Update()
      {
          if (currentCoinFill &lt; maxCoinFill)
          {
              currentCoinFill += fillCoinSpeed * Time.deltaTime;
          }
  
          coinFill.fillAmount = currentCoinFill / maxCoinFill;
      }
   //Penny Button
      public void PennyPush()
      {
          if (coinFill.fillAmount == 1)
          {
             sam.savingsAccountAmount += .01f;
             sam.savingsAccountText.text = sam.savingsAccountAmount.ToString("f2");
             currentCoinFill = minCoinFill;
          }
  
      }
  
   //Nickle Button
      public void NicklePush()
      {
          if (coinFill.fillAmount == 1)
          {
              sam.savingsAccountAmount += .05f;
              sam.savingsAccountText.text = sam.savingsAccountAmount.ToString("f2");
              currentCoinFill = minCoinFill;
          }
      }
  }
  </code></pre>
  
  <p>I am not sure if I need to do something with a parent of the Penny or Nickle  or if I should be using a <code>this</code> or set up some parent thing</p>