I am trying to get tweening working on a sprite that is a child of a Container-subclass, however the tween does not work. I am setting-up the tween within the Container-subclass constructor() when the Container is not yet added to the scene, which I assume is the reason it’s not working.
Is there an event I can hook that occurs when a game object is added to the scene, or do I need to use a bespoke method of my own?
A tween can work on anything, but I guess it’s possible you won’t get certain values you want until after the child and Container are added to the display list. I’m not sure.
You could set this.sys.displayList.addCallback but it seems a bit much. Can you just add the tween after the Container is in the scene?
Yeah I’ve moved the tween to preUpdate() and it’s still not working, so it’s the tween that’s the issue - not where I’m setting it up I am generally interested if there is such a lifecycle callback on game objects though, as it could be useful?
BTW the reason my tween wasn’t working was because I hadn’t passed paused: false when creating it, which seems strange as all examples I have seen don’t need that as paused is false by default. Does having the tween on the sprite within a container affect this, do you know?
Well I removed the paused: false line and it still works! I cannot explain why it wasn’t working before and I tried for a couple of hours Oh well, nvm.