I previously posted this in “How do I…” but I have a feeling this might be a bug
TL;DR - I can’t dynamically create prefab’s children outside the “onCreate” methods.
Here’s the original post:
I’ve been playing around with custom objects in gdevelop and here’s a custom action i created:
Here’s how it looks on the inside:
It takes in 3 parameters, a player object that I want to create, a hatId used to create a hat object (which is a child of “Player” custom object) and color tint to colorize the player’s sprite.
After it processes everything it calls another function called “createSelectedHat” to use all this data and customize the player
And everything seems to be working except for the hat object creation. It just isn’t getting created, but the color tint changes for some reason. What’s the cause of this?
It seems that if a “global” function calls a “player” function it can’t create player’s children?
And here’s the thing, when I call “createSelectedHat” from “onCreated” method
or when I create a player object in my scene events sheet and then use createSelectedHat in the same event it works just fine? The hat gets created. But it isn’t exactly what I was looking for.