Convert from ExitGames::Common::Object to float*
Comments
-
Hi @Rox.
If you need a copy of the array:
float* ary = ExitGames::Common::ValueObject<float*>(eventContent).getDataCopy(); short aryLength = *(ExitGames::Common::ValueObject<float*>(eventContent)).getSizes(); // some code that uses the array ExitGames::Common::MemoryManagement::deallocateArray(ary); // important: deallocate your array copy, once you don't need it any longer - otherwise the memory will be leaked
If you don't need a copy of the array, but only a pointer to the payload of the object:
float** pAry = static_cast<ExitGames::Common::ValueObject<float*>&>((eventContent)).getDataAddress(); short aryLength = *static_cast<ExitGames::Common::ValueObject<float*> // important: don't access pAry beyond the lifetime of eventContent, as it only points to member data of eventContent
In general I would like to recommend having a look at CPhotonLib::sendData() and Listener::customEventAction() in demo_typeSupport inside the Client SDKs 'Demos' folder, which focuses on sending and receiving all kinds of different data.
1