How do you get a varible from one script to another ?

I am trying to get a variable from one script to another the first script is called guny
here is the sender script

#pragma strict
var gy : float;
function Start () {

}

function Update () {
	gy = transform.eulerAngles.y;
}

and the reviver script called lflare
here it is

#pragma strict
var ngy : float;

function Start () {
	ngy = guny.gy
}
function Update () {
	ngy = gun;
}

Any help would be appreciated and please don’t put any links I looked through them already

:slight_smile:

I am going to link you to a few sites that may help your knowledge base in the long run. because even if you have seen these you could use a refresher. (not to mention I could have linked you the holy grail but you asked me not to so I will keep that to my self.)

http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Components.html

but to answer your questions is you need to establish a reference to the variable in the child script that you need. more so then that you need a reference to the class that the variable your want is in.

and there are many multiple ways of doing it and I have yet to learn about which one is right and which are less right.