How do I make a Boolean variable for just one object?

Okay this seems a very basic question, but for some reason I don't know how to do it. How can i set a boolean variable for only the scripts target object. Rather than the boolean be a "world" variable I want it to be "local" (Don't know if thats the right terminology).

private var watered : boolean = false;

function Update () {


This script is applied to an instantiated prefab which has been instantiated numerous times, but with Input.GetMouseButton on just one of the instances it causes all the instances to react. I would like the boolean var to apply only to the instance which has been clicked.

Thanks - C

I believe the keywords you're looking for are 'private', 'public' and 'static'. The Overview: Member Variables and Global Variables script reference page gives a decent explanation in the context of Unity.

By default, variables will be 'public'. I believe that you would consider this 'local'. I also think that you would call a 'static' variable a 'world' variable.

If you post your script, I can give a more specific answer.

Assuming the object has a collider, try moving your code inside OnMouseDown() instead of checking the mouse button input.

You're question isn't really about the boolean, its more about how to access a specific instance of an object with a mouse click.