Animation.setCurrentFrame will no longer try to call setOrigina or updateDisplayOrigin if the Game Object doesn't have the Origin component, preventing unknown function errors.

This commit is contained in:
Richard Davey 2020-01-27 14:48:50 +00:00
parent 009dad281f
commit 4de9d52769

View file

@ -1020,6 +1020,8 @@ var Animation = new Class({
gameObject.setSizeToFrame(); gameObject.setSizeToFrame();
if (gameObject._originComponent)
{
if (animationFrame.frame.customPivot) if (animationFrame.frame.customPivot)
{ {
gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY); gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY);
@ -1028,6 +1030,7 @@ var Animation = new Class({
{ {
gameObject.updateDisplayOrigin(); gameObject.updateDisplayOrigin();
} }
}
return gameObject; return gameObject;
}, },