Basically… how do you call a variable from a script attached to the parent of an object?
Parent is called ‘Ball’, script is called ‘MovementScript.js’ & variable is ‘activeCamera : boolean;’
Child is called ‘large_camera’ & script that is trying to receive the variable is ‘LookAtSphere2.js’
Any help would be appriciated, there didnt seem to be any way in the scripting reference to do this, not any way that I understood at least haha. Thanks.
Usually it’s better to get the script reference once at start and use a stored reference to access the script:
// In your "LookAtSphere2" script
private var mScript : MovementScript;
function Start()
{
mScript = transform.parent.GetComponent(MovementScript);
}
// [...]
mScript.activeCamera