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
- Line Brush blue outline appears at incorrect position when painting start of line in Tile Palette
- [URP] All materials render black when building via batchmode or without rendering Scene/Game view in Editor if Decal renderer Technique is set to "Automatic"
- Player Tags list shows extra blank space behind the scrollbar in the "Player Tags" settings window
- Edit Angular Limits gizmo handles are small and easy to miss-click in the Scene view
- Duplicate Player Tag save fails silently with no error or validation message
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.