Download

Crash with multi-flipbook component

Hi everyone.

I’m making a 2D game using Paper2D and I’m using a component to manage the character’s appearance since I need it to be modular.

It all boils down to this:
I have an array of FlipbookComponents mounted on my component.


UPROPERTY(BlueprintReadWrite , Category = Graphic)
TArray<UPaperFlipbookComponent*> livello;

Each component is a “slot” for the character, so I can change the appearance of the eyes, for example, but leave the rest untouched.
This array is constantly updated with the right animation (idle, walking right, etc…) and every component is constantly updated by the room regarding the rendering sorting policy order. For many reasons I have to sort everything myself.


std::map<Animazione , UPaperFlipbook**> mappazza;

This map is used to store the pointers for each animation. So, for each of the Animazione (animation) enum values (again… idle, walk left…), I have an array of pointers to flipbooks. One pointer for each slot.

It seems rather convoluted, I realize that, but this is the only way I could find to accomplish what I wanted.

And everything works. Up until I try and change a slot when the character picks up an object.
When I change the slot, meaning I update the map with the pointers to use another flipbook for the eyes in each animation, after a while it crashes. And this is what I get:

The strangest thing is that it does not happen right away, but it seems to work for a while and then it crashes. I cannot identify the trigger. I have to move to get the crash, so it has something to do with the passage from one animation to another, but other than that I don’t know. Also, it does not seem to happen if I use the “Play in Editor” mode. It happens with the “Standalone” mode and with the packaged project.

I can provide more code and information, if you need to know more about the structure of my component and how I sort and update FlipbookComponents.

Thank you in advance.

P.S.
I’m not even sure if this is the right section or if I’m explaining everything in a proper fashion.
Also, English is not my native language, so grammar nazis are welcome to the feast (I mean it: it’s like a free English lesson).

I know that 3 years have passed by now, but i just want to add my 10 cents to this. So am I right that on changing a flipbook your standalone game crashes? That’s pretty interesting, since I’m facing a similar issue at the moment, where my game crashes not during a level but when loading it. I’m suspecting attached flip components to cause this at the moment, but that requires some more testing. What did fix your problem? I haven’t familiarized with c++ yet (bp only so far) but I can imagine our problems are of similar nature.
Greetings Vinni

I’m getting a similar issue with what seems to be any paper 2d sprite in a blueprint in 4.25. It crashes on loading or unloading the level in a built project only (nativized bp or not). I changed some of the flipbooks to materials on planes and those levels stopped crashing. I have a lot of paper2d flipbooks though and would basically have to redo the entire project. Does anyone know if this is a known bug that is being worked on? Or if there is any better solution?