Search Issue Tracker
By Design
Votes
0
Found in
2019.3
2019.3.0f1
2020.1
2020.2
Issue ID
1228277
Regression
No
In Standalone build, File WriteAllText does not save the file when using IL2CPP or Mono with ".NET Standard" Api compitability
How to reproduce:
1. Open attached project "MinerSaveJson.zip"
2. In Project Settings, make sure that either "IL2CPP" scripting backend is selected or "Mono" scripting backend with ".NET Standard" Api compatibility Level
3. Build and Run
4. In Standalone, press Load -> Load
5. Press W to move up
6. Esc -> Save Game -> Main Menu
7. Load -> Load
8. Observe the position of the player
Expected result: player position is saved and is now above the spawn point
Actual result: player position and all the tiles were not saved, the player is at its spawn point
Reproducible with: 2019.3.13f1, 2020.1.0b8, 2020.2.0a11
Could not test with: 2018.4 due to errors in the console window
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
- PropertyDrawer gets disposed while still being active when adding a secondary component
- Realtime GI behaves differently when using Unlit (Amplify) and Lit (Shader Graph) shaders in URP
- API Updater strips Unity-owned Custom Attribute references within precompiled DLLs
- [iOS] ListView is flickering when scrolling over the end
- The Aspect Ratio Fitter Component on a Prefab displays a parent-related warning despite the Prefab's inability to have parents when "Envelope Parent" or "Fit In Parent" modes are used
Resolution Note:
The Newtonsoft.Json code uses System.Reflection.Emit to create code at runtime. Since IL2CPP is an ahead-of-time compiler, it does not support System.Reflection.Emit.
Mono provides a just-in-time compiler, so it does support System.Reflection.Emit. But System.Reflection.Emit is not a part of .NET Standard 2.0, so this code will only work with Mono using the .NET 4.x Api Compatibility Level.