Jump to content

addExternFunction() should be before Engine initialization?


photo

Recommended Posts

We used this pattern

Interpreter::addExternLibrary("my_application");

Interpreter::addExternFunction("my_application.init",MakeExternObjectFunction(&my_application,&MyApplication::init,"1"));

to export some member functions into UnigineScript. Later we realized that callbacks to such functions seem to work *only* if the call to addExternFunction() is *before* Engine::Init()

Any function that is exported after engine initialization doesn't seem to work. Is this intentional or are we missing something?

If this is by design, it is too restrictive and the initialization of various C++ sub-systems becomes unnecessarily complicated.

 

-a.

Link to comment
  • 2 weeks later...

Export into Unigine Script after engine initialization should work properly.

 

But in this case you should not use exported libraries, functions and classes during engine initialization. Because engine still knows nothing about new functionality.

For example during engine initialization system script is loaded.

Also if you use console_command "world_load my_world" (as engine config parameter or as a command-line argument) world script will be loaded during engine initialization too.

Link to comment
×
×
  • Create New...