BastiaanOlij / gdnative_cpp_example

GDNative C++ example for tutorial
MIT License
65 stars 31 forks source link

GDNative property auto-reload #5

Closed m4gr3d closed 5 years ago

m4gr3d commented 5 years ago

I'm following the tutorial section about adding properties via GDNative, and to get the added property to show in Godot, I have to close and reopen the project. Is that expected behavior?

Running Godot 3.1 beta 11.

BastiaanOlij commented 5 years ago

The reloadable setting will allow you to swap out the DLL without closing Godot but i've found it unstable especially when you do things like these as the allocated memory is still from the older version. There is a call you can do that will trigger Godot to reload the properties, I use it in ProcMesh because a lot of the properties are dynamic there so have a look at that project.

But I kinda don't trust replacing compiled code with instances loaded in memory so I tent to turn reloadable off and just reload Godot :)

m4gr3d commented 5 years ago

Thanks for the explanation! Based on your description, I agree it should be used with care to avoid subtle issues creeping up.

It might be worth setting the 'reloadable' setting to true in the tutorial to match the description, and add a caveats section to mention the issue(s) that may caused. I was myself under the impression that I'd done something wrong since the behavior on my machine was not matching up with the tutorial.

BastiaanOlij commented 5 years ago

I think it was set to true when I wrote the tutorial, pretty sure I put it to false when it kept crashing on me :)

m4gr3d commented 5 years ago

I added PR2234 which includes a note to set it to true to get the desired behavior :)

m4gr3d commented 5 years ago

Closing since PR2234 was merged!