Hi,
I’m working on some rather low system operations (assembly) that I just can’t perform in a managed environment. Periodically I would like to pass an “array” of bytes from my c++ code to unity. Can this be done in a relatively performant way? Since this is unmanaged c++ I do not have any type of array that would be recognized by both Unity and c++. Is there perhaps a way to stream the data via the memory? Or is serialization/deserialization to the harddrive the only option there is?
Any help would be appreciated.
Thanks!
1 Answer
1Since this is unmanaged c++ I do not
have any type of array that would be
recognized by both Unity and c++.
Well in c# it will be a byte array of course, from c++ you could use Marshal.Copy, some examples:
Go to the self answer: c# - Fast copy of Color32[] array to byte[] array - Stack Overflow
Or is serialization/deserialization to
the harddrive the only option there
is?
Of course not, see above.
Also make sure you put your plugin(your unmanaged code) in the plugin folder.
Thanks a lot for this thorough answer. I didn't know something as neat as the marshal functionality existed.
– MrAssembler