- Home /
Procedural icons generator - Texture2D.ReadPixels works incorrectly in Unity 5.6
I have a system which proceduraly generates icons for a lot of 3D models in my constructor game.
This is how I generated an icons, and the systems worked well:
public Texture2D GetImageFromCamera (Camera camera) {
camera.Render ();
Texture2D image = new Texture2D (SizeX, SizeY);
image.ReadPixels (new Rect (0, 0, SizeX, SizeY), 0, 0);
image.Apply ();
return image;
}
So a used a loop, spawned each 3D model, located it in front of camera and invoked this function.
Here is an example of result:
But after I updated a project to Unity 5.6 (maybe another version), the result became very strange: For example:
There is several problems:
Background should be transparent, but now it is white.
Something with Z order? Far leg of the chair should not be visible. Have no idea how it is possible.
Something with lighting. I setup nice lighting with 3 point lights for this improvised "photo studio", but as you see, lighting is bad.
Any idea what may cause it? The problem exist in two different projects where this system is used.
Your answer
Follow this Question
Related Questions
Sniper Scope Render Texture 0 Answers
Apply Render Texture To GUI + Transparency? 2 Answers
Texture stretching incorrect way. 0 Answers
Create texture from current camera view 3 Answers
Render Texture display different with its camera preview 1 Answer