I have a script on a game object that needs to scale and rotate based on information from another script. I have set up all my necessary variables and am trying to debug. I am getting an error that RootHandler is not a member of UnityEngine.GameObject. I understand what that means but I can’t figure out how to access my locator variable from the other object. I’ve posted the whole script as it is quite short.
#pragma strict
var rootHandler: RootHandler;
var rootCounter: rootCounter;
var rot: float;
var currentCount: int = rootCounter.count;
var lastCount: int = rootCounter.count - 1;
var currentLocator: GameObject;
var lastLocator: GameObject;
var currentRootName: String;
currentRootName = currentCount.ToString();
var lastRootName: String;
lastRootName = lastCount.ToString();
function Start () {
}
function Update () {
currentLocator = GameObject.Find(currentRootName);
lastLocator = GameObject.Find(lastRootName);
Debug.Log(currentLocator.RootHandler.locator);
Debug.Log(rootHandler.transform.position);
Debug.LogWarning(Vector3.Angle(rootHandler.locator.position, rootHandler.transform.position));
}
The error is on line 21. RootHandler is the script in which the variable locator can be found.
Thanks for your help!