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”…
a hint would be nice…thx:)