Search Issue Tracker
Fixed in 2020.1.X
Votes
0
Found in
2019.2.0a6
2019.2.9f1
2019.3
2020.1
Issue ID
1192834
Regression
Yes
TextAsset.bytes returns different bytes with different file extensions
Reproduction steps:
1. Open project in "TextTest.zip"
2. In "TextAssetTest.cs" the test will compare bytes of 2 identical files (text wise) but with different extensions (".txt", ".bytes")
3. Open Test Runner window (Window -> General -> Test Runner)
4. Click "Run All"
Expected result: test will not fail
Actual result: test fails
Reproducible with: 2019.2.12f1, 2019.3.0b10, 2020.1a12
Not reproducible with: 2017.4.33f1, 2018.4.12f1, 2019.2.0a5
Notes:
1. TextAsset.bytes documentation implies that for getting bytes of a file, it needs to have the extension ".bytes". Even though documentation is the same for all versions, the behavior is different
2. Only some characters in files cause the issue, such as 'š', 'ž', for example. Otherwise, test results with .txt and .bytes extensions will be the same
3. Test is defined in "TextTestAsset.cs"
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
- SpriteShapeController.OnWillRenderObject() is ~20 ms when using SpriteShapeController.BakeMesh() and never updating the spline
- Editor freezes briefly when "multi-selecting" TextMeshPro GameObjects In the Hierarchy window in Prefab Mode, if 5 or more Inspector windows are open
- OnEndDrag event not triggered when losing Editor focus during simultaneous Left and Right mouse drag
- Texture displays visual artifacts and has a broken aspect ratio when it is imported in RGB 48-bit format
- Diagnostic Warning Resets When Navigating Away and Returning to Diagnostics Settings
Resolution Note (fix version 2020.1):
https://docs.unity3d.com/ScriptReference/TextAsset-bytes.html
In order to get actual bytes from file, .bytes extension must be used.
If different extension is used, returned bytes are received from TextAsset.text string value by decoding it to UTF8 format
Fixed in 2020.1.0a17