title: Raycast to hit mutiple objects with the same script but only decrease the value of the object being hit?
body: <p>I have 4 objects each with the planthealth script attached, as it is right now this will only affect one of them, I have tried making 4 seperate scripts for each game object but end up getting an error not sure why. I am assuming that is a super bad way to acomplish this so if anyone could help me figure out how to make a raycast distinguish different objects so that the values only increase when the ray is hitting that specific object.</p>
  
  <pre><code> void Ray()
  {
      Vector2 downward = rayOrigin.transform.TransformDirection(Vector2.down) * rayDistance;
      Debug.DrawRay(rayOrigin.transform.position, downward, Color.green);
      if (Physics.Raycast(rayOrigin.transform.position, rayOrigin.TransformDirection(Vector2.down), rayDistance, plant))
      {
          print("wew");
          Plant_Health plant = plantRef.GetComponent&lt;Plant_Health&gt;();
          plant.health += 0.25f;
      }
  </code></pre>