Jump to content

[SOLVED] get_function scope


photo

Recommended Posts

Simply put, how do I call world function from system function and vice versa via get_function? get_function seems only to work locally, which is a shame.

Link to comment

You can call a system function in every world class with engine.system.call(string function,variable arg0,variable arg01....). Same with world-function engine.world.call(string function,variable arg0,...). But be careful, the world function can only be called if a world is loaded, and the function exists in their .cpp-file. You can find more information at the documentation (Unigine-Script -> Engine Library -> Engine Functions -> engine.system or engine.world)

Link to comment

Hi Cristian,

Thanks for your answer. I am familiar with engine.*.call function and use it as you describe, but you misunderstood my query I think. I want to use get_function and then call call my functions via integer reference, as they are repetetive calls, that happen very often and i want to do some optimization there.

 

To put it in code

//world code..

int x=engine.system.get_function("samplesystemfunction");

...

...

...

engine.system.call(x, arg1, arg2);

 

and vice versa.

Link to comment

get_function() returns an ID that can ONLY be used for call(), just like noted in the docs. engine.system.call() (as well as engine.world.call() and engine.editor.call()) take a function name for an argument. So no, this won't work.

Link to comment
×
×
  • Create New...