c# - Destroy gameObject oncomplete -
i using script destroy gameobject oncomplete, doesn't work.
void jump() { if (currentcube.transform.position.y == 0f) { itween.moveto (currentcube, itween.hash ("y", currentcube.transform.position.y - 15f, "time", 0.8f, "oncomplete", "destroyoncomplete", "oncompletetarget", currentcube, "easetype", "easeincubic", "looptype", "none", "delay", 0)); } } public void destroyoncomplete() { destroy (currentcube); debug.log ("destroyed " + currentcube); } does know why doesn't work?
from see script not attached currentcube , you're trying invoke destroyoncompleted on currentcube. try :
itween.moveto ( currentcube, itween.hash ( "y", currentcube.transform.position.y - 15f, "time", 0.8f, "oncomplete", "destroyoncomplete", "oncompletetarget", gameobject, // here had `currentcube`, can try `this` instead "easetype", "easeincubic", "looptype", "none", "delay", 0 ) );
Comments
Post a Comment