LoadRawTextureData - how to use?
Please explain how LoadRawTextureData works.
if i do:
// request for jpg from server
var bytes = _wc.DownloadData(uri); // The request is executed outside the main thread
var tex = new Texture2D(width, height, TextureFormat.ARGB32, false);
tex.LoadImage(bytes); // <= slow
image.texture = tex;
all work fine, but LoadImage very slow :\
I'm trying use LoadRawTextureData , but always recive error:
UnityException: LoadRawTextureData: not enough data provided (will result in overread).
As i understand it's because my data is not formatted. I'm don't know ho to do it :\
For test i'm try this:
var tex = new Texture2D(width, height, TextureFormat.ARGB32, false);
tex.LoadImage(bytes);
var tex2 = new Texture2D(width, height, TextureFormat.ARGB32, false);
tex2.LoadRawTextureData(tex.GetRawTextureData());
image.texture = tex2;
But this also does not work. It's return previous exception.
Can someone help me with this problem?
PS: Unity 5.6.0f3
Your answer
Follow this Question
Related Questions
Better way to edit RawImage texture data?,Better way to edit a RawImage texture? 0 Answers
Trying to dynamically animate a Gimbal? 0 Answers
[SOLVED] Problems creating a Sprite through script 0 Answers
Unable to save generated/rendered Texture2D to use for billboard 3 Answers
Anyone here experience differences in script behaviour between iOS and Android? 0 Answers