tolga Posted May 16, 2023 Posted May 16, 2023 Hi, Let's say I have this in my .prop file: <parameter name="blah" type="array" array_type="int" array_dim="0"/> And this in my .H file: PROP_ARRAY(Int, blah) This does not work on the CPP side: for (int i = 0; i < blah.size(); ++i) { int someInt = blah[i]; } I can actually see the definitions inside <UnigineComponentSystem.h>. What am I missing? Thanks!
cash-metall Posted May 16, 2023 Posted May 16, 2023 Quote This does not work on the CPP side: Tell us in more detail what exactly does not work and how do you check? everything looks right, it should work. my code: // in test.h #include <UnigineComponentSystem.h> class TEST: public Unigine::ComponentBase { public: COMPONENT_DEFINE(TEST, Unigine::ComponentBase); COMPONENT_INIT(init); PROP_ARRAY(Int, blah); private: void init(); }; // in test.cpp #include "test.h" REGISTER_COMPONENT(TEST); void TEST::init() { Log::message("BEGIN\nsize of blah array on %s(%d) node is %d\n", node->getName(), node->getID(), blah.size()); for (int i = 0; i < blah.size(); ++i) { int someInt = blah[i]; Log::message("parameter %d = %d\n", i, someInt); } Log::message("END\n"); } setting in editor console output: BEGIN size of blah array on sun(824505625) node is 4 parameter 0 = 6 parameter 1 = 5 parameter 2 = 4 parameter 3 = 3 END show a screenshot of how exactly you filled the array, and your console output
tolga Posted May 16, 2023 Author Posted May 16, 2023 Sorry to bother. This was caused by the fact that the function was defined as const :) Removed it and it's working.
Recommended Posts