Search Issue Tracker
By Design
Votes
0
Found in
2017.4.0f1
2017.4.5f1
Issue ID
1106629
Regression
No
Loading a PNG file with Resources.Load<Texture2D> and Texture2D.LoadImage produces different results
To reproduce:
1. Download attached project "PNG Load.zip" and open in Unity
2. Open "test" scene
3. Enter to Play mode
4. Press "Load As PNG" button and observe results
5. Press "Load From Resources" button and observe results
Expected results: Observe that loading Texture by Resources.Load<Texture2D> and Texture2D.LoadImage produce the same results (Tone)
Actual results: Observe that loading Texture by Resources.Load<Texture2D> Texture is not the same when You load it directly from PNG by Texture2D.LoadImage
Notes:
- This issue appears on both Windows and macOS
- A Texture which loaded from Resources is lighter than loaded as PNG
- This issue does not happen with JPEG
Reproduced on Unity 2017.4.0f1, 2017.4.17f1, 2018.1.9f2, 2018.2.19f1, 2018.3.0f1 and 2019.1.0a11
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- The first frames are skipped when playing a video
- Text auto-scrolling can not work when naming assets/objects until backspace key is pressed
- Shadows are not cast when the Light's CullingMask and the GameObject's Layer do not match
- Graphics.DrawMeshInstanced does not work when 2D Renderer and 2D Shaders are used
- SpeedTree does not move when using WindZone
RobAtApex
Apr 27, 2022 09:22
Can still replicate in 2020.1.2. It's a terrible bug that takes much time to track down after ruling out many other lighting issues.
How can they say this is "by design" and resolved with no explanation?
If you use LoadImage with a PNG, it comes in darker than the actual image in the file. That's a bug.
Nokola
Dec 27, 2019 06:39
I just hit the same issue - in my case a paint app that can't load a PNG file correctly because of this problem.
To reproduce:
1. In Paint.net create file and fill with gray 50,50,50
2. In Unity open with LoadImage
Expected: values in texture are RGB 50,50,50
Actual: values in texture are RGB 42,42,42
Obviously a horrible bug.
sam-rae
Jun 19, 2019 08:47
"By Design"?
Am I being dense or should PNGs load with the colours that were actually in the file?