Jump to content

[SOLVED] callback in GameFramework


photo

Recommended Posts

Hi guys,

 

after the last update I started to migrate my code to the new GameFramework. First I want to integrate my MainMenu with different WidgetButtons.

Now I have stated a bug with the Widget-callback inside the Framework. Every time, when I used the "this" operator for the callback-functions. The defined function was successfully called (with the new prefix). But if I quit the game or change the level Unigine stopped working. But that only happend during the shutdown of the level file and with using the "this" operator. When I define widgets with callback-functions without the "this" operator everything seems to be fine.

 

Next step, I created a new Interface-class to separate the callback functions from the level-file (like the framework-sample), but same happend here. The log-file doesn't have any errors.

 

Any hints or workarounds?

 

Link to comment

Hi Christian,

 

You should remove callbacks from all your Widgets on shutdown and re-enable them on init. The framework logic is implemented in the world script and is reloaded every time the new world is loaded. This means that your custom code will be removed on shutdown, but callbacks would still try to get access to this memory. And as a result you will get this crashes.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi silent,

 

thanks for the hint. I have supposed something like that.

 

The WidgetButton.setCallback(GUI_CLICKED,NULL) do that trick. Never red something about that possibility. :)

Link to comment
×
×
  • Create New...