Custom behaviour: onCreated object position is always 0,0

Hello all!

As stated in the topic title, I’m having an issue with custom behaviours: when the onCreated function is fired, the object position is always 0,0. Object only goes to propper world position afterwards. I’d need to access the final position upon creation to set some variables instead of using the general event sheet to set them…

Is there a way to do this? Am I missing something?

Can you put here events Screenshot please?

When the game starts and the instance is created (running onCreated), that log shows 0,0.

If I log the position in doStepPreEvents it logs the correct object position.

This is the scene, object is the fly, which is not at 0,0

I tried using “at the beginning of scene” as a condition, but it still shows 0,0

That has been a known issue for a while: Behavior lifecycle function onCreated called early · Issue #3663 · 4ian/GDevelop · GitHub

1 Like

That’s the solution I went with (using a run once event in onprestepevents), but it didn’t feel right considering the structure of functions.

Good to know it wasn’t a case of my lack of understanding, anyway. Looking forward to the resolution.