From 4de9d5276900331fe2e9f584e3de4b8ea3ad870b Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Mon, 27 Jan 2020 14:48:50 +0000 Subject: [PATCH] `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. --- src/gameobjects/components/Animation.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gameobjects/components/Animation.js b/src/gameobjects/components/Animation.js index 5c58515d1..a21a1b752 100644 --- a/src/gameobjects/components/Animation.js +++ b/src/gameobjects/components/Animation.js @@ -1020,13 +1020,16 @@ var Animation = new Class({ gameObject.setSizeToFrame(); - if (animationFrame.frame.customPivot) + if (gameObject._originComponent) { - gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY); - } - else - { - gameObject.updateDisplayOrigin(); + if (animationFrame.frame.customPivot) + { + gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY); + } + else + { + gameObject.updateDisplayOrigin(); + } } return gameObject;