There are number of unresolved issues with scripting system:
Script manually assigned to a node will be not initialized
When you doing some_node.script = Some(Box::new(YourScript::new())) the engine will not call on_init of the script. This is not a problem, until you use prefabs with scripts assigned in the editor, but could be a huge problem if you want to create objects procedurally.
Potential solution: Send a message from the scene node to the parent graph and process these messages in main loop and call on_init correctly.
This prevents performing some clean up before script is destroyed. Some scripts may create scene entities that must be deleted when the script is about to be destroyed.
Potential solution: Send script instances to the parent graph and destroy them one-by-one in the main loop. When the scene is destroyed, send all non-destroyed (pending) scripts to the engine and destroy them one-by-one in the main loop, this will allow to do a clean up in the parent plugin.
Other
There could be some other issues that will be discovered later.
There are number of unresolved issues with scripting system:
Script manually assigned to a node will be not initialized
When you doing
some_node.script = Some(Box::new(YourScript::new()))
the engine will not callon_init
of the script. This is not a problem, until you use prefabs with scripts assigned in the editor, but could be a huge problem if you want to create objects procedurally.Potential solution: Send a message from the scene node to the parent graph and process these messages in main loop and call
on_init
correctly.Noon_destroy
method inScriptTrait
Fixed in: https://github.com/FyroxEngine/Fyrox/commit/389a564c41caccc5bf05658e1d90439355de02a6
This prevents performing some clean up before script is destroyed. Some scripts may create scene entities that must be deleted when the script is about to be destroyed.
Potential solution: Send script instances to the parent graph and destroy them one-by-one in the main loop. When the scene is destroyed, send all non-destroyed (pending) scripts to the engine and destroy them one-by-one in the main loop, this will allow to do a clean up in the parent plugin.
Other
There could be some other issues that will be discovered later.