"global" var - noob question;)

hey there, i´ve just one simple question, because i didn´t found a solution while searching the forums yet.

here we go: is there a easier solution to get a variable from one js to another js than this?
example:

//first.js
var EnemyLaserDmg:float;
//second.js
var MyEnergy:float;
var ScriptFromTarget:GameObject;//were "first.js" is attached to
private var getScript;

function Start()
{
getScript = ScriptFromTarget.GetComponent("first");
}
function OnTriggerEnter (hit : Collider) 
{
if(hit.gameObject.tag == "enemylaser")
MyEnergy -= getScript.EnemyLaserDmg;
	
}

??
need an easier way to get a var from one script to another without connecting game objects and using terms like “getScript.EnemyLaserDmg”… :confused:

a hint would be nice…thx:)

http://unity3d.com/support/documentation/ScriptReference/index.Member_Variables_26_Global_Variables.html

Read the global variables section.

ah thx… so i have to use first.EnemyLaserDmg instead of getScript.EnemyLaserDmg in second.js …but EnemyLaserDmg needs to be a static var in first.js - thats all? …pretty easy;) damn :smile: