title: How can I control two images with the same button?
body: <p>I have two images named hungerbar and cheesebar.</p>
  
  <p>when the mouse approaches the cheese one button is activated. and I added pointer down function so when I press cheesebar level is decreasing and when the chees bar is empty the first cheese disappears.</p>
  
  <p>and the second cheese appears but I can not control it with the same code. I dont know how to.</p>
  
  <p>here some samples of my code;</p>
  
  <pre><code>void Start()
  {
      cheesbar1= GetComponent&lt;Image&gt;();
  }
  
  void Update()
  {
      cheesbar1.fillAmount = eatencheese / maxcheese;
  }
  
  private void FixedUpdate()
  {
      if (eating== true)
      {
          eatencheese--;
          hungerscript.gettinghungery += 3f;
      }
      if (eatencheese &lt;= 0)
          Destruction();
  }
  </code></pre>
  
  <p>SO that codes control only one image (Cheesebar1) . I want to use the same code and game object for controlling the second one..</p>