Search Issue Tracker
Won't Fix
Won't Fix in 2023.3.X
Votes
1
Found in
2021.3.30f1
2022.3.9f1
2023.1.12f1
2023.2.0b8
2023.3.0a4
Issue ID
UUM-48261
Regression
No
"PlayerPrefs.GetString" returns an empty string when the default value is set to "null"
Reproduction steps:
1. Open project “PlayerPrefsRepro.zip”
2. Open “SampleScene”
3. Enter Play Mode
4. Observe the Console
Expected result: No error is thrown
Actual result: “AssertionException: Assertion failure. Values are not equal. Expected: == “ error is thrown in the console
Reproducible with: 2021.3.30f1, 2022.3.9f1, 2023.1.12f1, 2023.2.0b8, 2023.3.0a4
Reproducible on: macOS Ventura 13.2.1 (Intel), Windows 11 (by the reporter)
Not reproducible on: no other environment tested
Notes:
- Also reproducible in Standalone Player
- changing line 12 in “Repro.cs” to {{Assert.AreEqual("", PlayerPrefs.GetString("test-key", null));}} gives Expected results
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
- Color Picker preview rectangle doesn’t update when adjusting colors for Specular color field for Terrain Layer
- Character Controller fall through the ground when touches 100 colliders
- Paragraph Spacing and the 'line-height' tag are not working when the Advanced Text Generator is enabled
- Non-standard error icon is used in Shader Graph
- GameObject drops to the last position in the Hierarchy when a RectTransform Component is added
Resolution Note:
This is by design. You can never get null from PlayerPrefs.GetString() API.
Resolution Note (2023.3.X):
This is by design. You can never get null from PlayerPrefs.GetString() API.