Limiting number of mouse clicks

hi,
I am trying to make a game where the user can only click twice (or thrice) on some object after which the click will be non functional.(using OnMouseDown function, Its just a click game)

The number of clicks is shared by many scripts in the scene and so i think its not a good idea to define that as a variable in each script as i might have to edit the script many times for each differnt level.
I am trying to make a single scipt which will hold tht number and the other scripts will reference tht number from that particular script.
Is it possible to do so??

I was trying to make that number as a static variable in a empty gameobject and then call it via other scripts but may be i am doing something wrong or its not possible… i also tried various GetComponent methods but i’m just not getting it. Can someone please help me out??

you can use this to access another script:

//C#
public GameObject ScriptObject;
public ScriptName SomeName;

//in the update()
SomeName = ScriptObject.GetComponent<ScriptName>();
//u can now use the SomeName variable to access any 
//public variable or function from ur script.

//Java Script
public ScriptObject : GameObject;
public SomeName : ScriptName;

//in the update()
SomeName = ScriptObject.GetComponent(ScriptName);
//u can now use the SomeName variable to access any public 
//variable or function from ur script.

Hope this helps you.

Well it sounds like you were on the right track with the statics, it should work like this:

#SomeScript.js

  static var count : int = 0;

From elsewhere:

  if(SomeScript.count > 3)