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
Comments (3)
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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
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?