Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to re-instantiate a project #7

Open
QuentinPerez opened this issue Jun 26, 2024 · 2 comments
Open

Unable to re-instantiate a project #7

QuentinPerez opened this issue Jun 26, 2024 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@QuentinPerez
Copy link

Hi there 👋

First of all, thank you for your work. I have been waiting for this feature for a long time!
I am trying to integrate libgodot into an iOS project where I launch and stop several games, but when I instantiate, then deinstantiate, and then instantiate again, the app crashes. Do you have any idea why this happens? Is it supported?

thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x131b06788)
    frame #0: 0x00000001035eb0f4 GameStore`ObjectDB::add_instance(Object*) + 88
    frame #1: 0x00000001035ea70c GameStore`Object::Object() + 144
    frame #2: 0x000000010316ec30 GameStore`Time::Time() + 20
    frame #3: 0x000000010312049c GameStore`register_core_types() + 200
    frame #4: 0x0000000100f86104 GameStore`Main::setup(char const*, int, char**, bool) + 568
    frame #5: 0x0000000100f83c60 GameStore`libgodot_create_godot_instance + 88
@kisg
Copy link
Contributor

kisg commented Jul 4, 2024

This is currently a known limitation of Godot: it cannot be reinitialized after the first initialization / destroy sequence. I will add this to the description of the PR and the Doxygen docs to make this clear. An option to work around this is to not kill the whole Godot instance, but to load a new PCK, and initialize a new SceneTree with the contents of that PCK.

@kisg kisg self-assigned this Jul 4, 2024
@kisg kisg added the documentation Improvements or additions to documentation label Jul 4, 2024
@QuentinPerez
Copy link
Author

QuentinPerez commented Jul 4, 2024

We succeeded in making it work by patching Godot and Godot-cpp. Unfortunately, it's hard to upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants