Igor_de Posted November 2, 2012 Share 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()); } Link to comment
frustum Posted November 2, 2012 Share 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(); Link to comment
Igor_de Posted November 2, 2012 Author Share Posted November 2, 2012 Works fine, thanks. Link to comment
ulf.schroeter Posted November 2, 2012 Share 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 Link to comment
manguste Posted November 6, 2012 Share Posted November 6, 2012 Ulf, I'll surely revise the docs as soon as possible. Link to comment
Recommended Posts