system
November 11, 2011, 1:03pm
1
Hi,
I have two scripts attached to one prefab I’m trying to call a function in one of them from the other:
In the caller
var rightLines = CheckRight.checkRight(X, Y);
in the other script named CheckRight.js:
function checkRight(X, Y){
...
return rightLines}
Any help much appreciated
If you have a reference to the gameObject on which your ‘CheckRight’ script is a component, just use
checkRightGameObject.GetComponent(CheckRight).checkRight(X, Y);
system
November 11, 2011, 2:42pm
3
Thanks,
Both scripts are attached to the same object called ‘tile’, do I need to explicitly reference ‘tile’ from one script to access its functions from the other script, if so how?
Kind Regards