Igor_de Posted November 2, 2012 Posted November 2, 2012 I am trying use this solution https://developer.un...-as-a-variable/ but got crash. Reproduced on https://developer.un...&attach_id=1200 from https://developer.un...-uniginescript/ topic. Add in C++ mydata testData; testData.name = "Hello from C++"; engine->runWorld("helloStruct", Variable(TypeInfo(TypeID<mydata*>()), &testData)); Add in script void helloStruct(mydata data) { log.message("%s\n", data.getName()); }
frustum Posted November 2, 2012 Posted November 2, 2012 Please use the pushWorld()/popWorld() functions around your code: mydata testData; testData.name = "Hello from C++"; engine->pushWorld(); engine->runWorld("helloStruct", Variable(TypeInfo(TypeID<mydata*>()), &testData)); engine->popWorld();
ulf.schroeter Posted November 2, 2012 Posted November 2, 2012 This seems to be a so common "mistake" most probably supported by missing clear UNIGINE documentation and C++ examples on mandatory usage of engine->push/popWorld() /engine->push/popSystem() when calling script part from C++. Suggestion: documentation improvement and update of embedded code snippets to include engine->push/popWorld()/System() code
manguste Posted November 6, 2012 Posted November 6, 2012 Ulf, I'll surely revise the docs as soon as possible.
Recommended Posts