accessing another script...problems for a new guy.

seems like this would be straightforward enough but this example makes no sense…

function Update () {
var otherScript: OtherScript = GetComponent(OtherScript);
otherScript.DoSomething();
}

according to this “OtherScript” is a type, and the scripts name points to itself as a type, and a variable…so can someone give me a real exmple please…to me this one is the same as saying that “variable a” is referenced as “A” and with it you can access script"A" so a = a = a which makes no sense…to me…

there was another post that took me to another example from unity but the page no longer exists…

My guess would be that GetComponent() returns a Component, not your desired Type. So you need to either convert it to your Type or use a generic version of GetComponent.

Best regards,
Peter.

yep, so here is what I actually did…

var scriptPlayerStats = GetComponent(playerstats);
scriptPlayerStats.AdjPlayerHP(-1);

that worked…thanks.