Sprite causing the game to insta-crash

hello guys
i need help with a error that’s happening, everytime i test my game, the game freezes, i tried using debugger but everytime it happens, gdevelop crashes aswell, i tried disabling shadows but nothing worked.

the only thing that worked was removing a object, i can’t remove this object from my game because he’s really important, if anyone knows what’s causing the error,

all the object has is: button behavior, pathfinding behavior and health behavior

thank you

Can you show what type of object it is, and what events you are using with it? Most relevant would be any “While” event you might’ve added, as they are the most common cause for freezes.

it’s a sprite, and im using only some simple events, like object is clicked and move to another object every 0.01 second, and these events are used by another objects too

the game crashes by simply putting it on the scene, and almost all event use “While” event

i don’t think there’s a fix for it :frowning:

Most crashes related to While events have nothing to do with the objects and everything to do with the While Events.

Please show your events and we can potentially help better.

Additionally, what is the size of the sprite? Max sprite size is ~2000x2000, but realistically everything should be 512x512 or under if there’s going to be animations involved.

That sounds like your problem, if you’re using the while event everywhere then you probably don’t understand what the while event actually is or does.
The while event means that the game will freeze and repeatedly check the condition and run the actions as long as the condition is true, only allowing to run the rest of the game when the condition is no longer true as a direct effect of the actions of the while event.

the sprite size is around 200 by 300 with 5 animation frames

when the event happens the game lags a lot and almost freezes, this happen (lesser)
to all other objects that is created by a spawner.
Screenshot_194
not sure if the spawner extension is the problem

the “while” event is used only when it’s needed, so pretty sure that’s not the problem here, thanks for helping anyway :slight_smile:

A freeze crash as you describe would pretty much only happen because of misuses of the while events. Would you mind posting a screenshot of your while events so we can check if your usage is correct as you think?

Screenshot_196
its correct right?

That isn’t a while event, which is why we are asking about the while event you mentioned above.

gotta wait now
aaaaaaaaaaaaa

I really think the crash is also due to pathfinding as it was lagging my game too(not so while ago)

i hope there’s a alternative for pathfinding :frowning:

Just for clarity. This is a While event.

These will sometimes cause an infinite loop if the while condition never becomes false. In this example. If the variable named Test never equals or exceeds 10 then the while event will loop until either the app crashes or is terminated.

A common issue is when people use wait inside of the while expecting it to create a pause. The problem is that time and other values and statuses get updated either between frames or in a different part of the project.

I fixed it by adjusting pathfinding, a event was repeating "Move (Object) to (Object) every 0.001 seconds, and that was causing lag, so FIXED

1 Like

Every event processes every frame that its conditions are true. Wether its pathfinding or forces or collision checks, having something like that means you were telling every object to refind its parh every frame.

Definitely would cause performance issues.

Last I looked into it, a lot of big RTS games didn’t update paths except for every hl.75 second for units (every 45 frames) and those can still bog down with huge fights.

also pixel size on the pathfinding behaviour helped a lot