-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
Description
When trying to disable or destroy an entity at the end of an animation. I either throws an error saying the skeleton cannot be null or keeps rendering the last frame of the animation.
SpineAnim.prototype.LoadSpine = function(entityName)
{
this.entity.spine.spine.skeleton.setSkinByName("default");
this.entity.spine.spine.skeleton.setSlotsToSetupPose();
this.entity.spine.states[1] = new spine.AnimationState(this.entity.spine.spine.stateData);
this.delegateObj = {
complete: this.onComplete.bind(this),
interrupt: this.onComplete.bind(this)
};
this.entity.spine.state.addListener(this.delegateObj);
this.entity.spine.state.defaultMix = 0.2;
this.entity.spine.state.addAnimation(0, "Idle", false);
};
SpineAnim.prototype.onComplete = function(track){
//this.entity.enabled = false <- doesnt work. continues to render last frame.
//this.entity.destroy(); <- throws an error saying skeleton cannot be null.
setTimeout(function(){this.entity.enabled = false;}.bind(this), 10); // <- works because it is outside of the on complete function.
};
Reactions are currently unavailable