I have byte series that contain data for a structure, I’m planning to read from these bytes to recreate an image. Problem is that I get following error:
JsonSerializationException: Unable to find a constructor to use for type UnityEngine.Texture2D.
So the question is, how do I give Texture2D an “empty construct” without it snapping on me? Or otherwise how do I turn binary data into Texture2D data?
Not sure if I understand your issue here, but usually you create a Texture2D with correct dimensions and texture format, then use SetPixel/SetPixels/SetPixels32 to insert the image data to the texture. Just get your binary data to Unity first, then write the data content to the texture. Wouldn’t this work for you?
For a reason its unnecessary to explain, I take a working image, then write its binaries down in a file, then want to read that file back, which now fails.
if you read this post, I wrote another one above it as well