peter-kish / gloot

A universal inventory system for the Godot game engine.
MIT License
625 stars 28 forks source link

In Godot, the assert will not execute after the game is exported as a release version. #220

Closed Achang0611 closed 3 months ago

Achang0611 commented 3 months ago

Program execution statements should not be placed inside an alert; otherwise, the program will not execute in the release version.

Expected Behavior

The item images are displayed in the release version of the game.


Current Behavior

I found that the "item" images in my game disappeared in the release version, while other images displayed normally. After debugging, I discovered that in the parse function of ItemProtoset, test_json_conv.data was not null in the debug version but was null in the release version. Then, outputting test_json_conv.parse(json) == OK returned true, indicating that the JSON parsed correctly.


Possible Solution

The game then displayed item images correctly in the release version.

Achang0611 commented 3 months ago

I apologize for the typo; please consider "alert" as "assert".

Achang0611 commented 3 months ago

Many inventory operations were also affected by this issue, and I manually replaced all assert statements with the revised operation mentioned above. The game is now running smoothly.

peter-kish commented 3 months ago

This is a very good point, I think there's a lot of bad assert usage in the code. I'll have to go through all of them and make corrections.

peter-kish commented 3 months ago

Fixed in https://github.com/peter-kish/gloot/pull/221