having a var in one script be known to another script.

I set a var Slider: float = 0;

in one script, the mainGUI script lets say.

I want to set that variable with a slider. I can make this part work.

and then in another script ( lets say a collision ) would like that value (set by the slider) to be seen and used by the second script.


function OnTriggerEnter (other : Collider) {

var setBall = GameObject.Find("steelBall"); setBall.rigidbody.drag = (Slider);


can any one help?


You can get the value of the slider the same way you set the drag of the steelball. Just obtain a reference to the object (e.g. using GameObject.Find), then you can access all of the variables of that object normally.

Also, you will need to set the Slider variable as public.

I am trying to do something similar. I would like to share a hashtable with other objects. is this possible and if so could you give some simple java pseudo code?