Hi,
I need to call a function that will Destroy the gameobject once a Tween has finished. I have it setup like this right now.
// set the gameobject that will recieve the callback
btnTween.eventReceiver=gameObject;
// set the function that will be called
btnTween.callWhenFinished="destroyObject";
// set the start position to the current position
The function that is called looks like this.
function destroyObject(sender:GameObject){
print("DESTROY ME");
Destroy(sender);
}
The problem I have is that there is no reference to the sender so the destroyObject function dosnt know which object to destroy. With Button Messages it seems a reference is passed through so I thought the same thing was valid for the onFinished function. If create the destroyObject function likes this instead it works nicely printing out the text "DESTROY ME" so the calling and naming seems to be ok just need to pass the reference through.
function destroyObject(){
print("DESTROY ME");
}
Any ideas on how to work around this?