title: unity - how to reference healthbar canvas and foreground rect transform from script
body: <p><a href="https://i.stack.imgur.com/vrsQf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vrsQf.jpg" alt="enter image description here"></a></p>
  
  <p>as you can see, I have player1, I have added a health canvas, with a red background and green foreground, I need to know how to access that in the script, what code I use in the script to access the green foreground's rect transform to decrease it and show more of the red when health goes down.</p>
  
  <p>Any help is appreciated...</p>
  
  <p>thanks</p>