Is it possible to pass functions as parameters to other script functions in UnityScript? Please note I am not using C# at all.
I’m getting this error:
InvalidCastException: Cannot cast from source type to destination type.
ActorController.FindPathToObject (UnityEngine.GameObject obj, ICallable callback)
When trying to run the code:
_actorCtrl.FindPathToObject(currentTarget, OnPathComplete);
The definition for FindPathToObject:
function FindPathToObject(obj : GameObject, callback: Function){
// do stuff here
}
The error comes from attempting to pass the callback argument, the gameobject parameter works fine by itself.
Any help would be greatly appreciated