Hi all,
You know unity player has settings before starting the game for quality but there is no such a thing for mobile platforms (as far as I see)
Is there any option approach for developer to let Android users to choose game graphic quality
You can do your own graphics options menu, some example code for URP is here:
I save the quality level to PlayerPrefs. On load of the build, read it back from PlayerPrefs, and if it exists then set quality to that value (if not there, then leave quality at default). As far as the UI for the player to select between, see any UI tutorial. I like using a slider which jumps between ints, but you can implement it a variety of ways.
thk
Unity should be doing this automatically with a key named âUnityGraphicsQualityâ.
Youâre correct, but only so long as the game doesnât crash or otherwise have its task ended uncleanly. I donât know about you, but it always irritates me whenever I play a game, save some options, then a few hours later the game crashes, and I find I have to set all the options again since they werenât really saved when I thought they were.
(Iâm pretty sure the quality setting is saved automatically on exit, not when the change occurs)
Quality settings is also available in runtime. Just make a few presets, and let user choose.
Alternatively, expose required options via menu or any other UI.
If itâs via PlayerPrefs I believe thatâs the intent - it saves on exit, or you call PlayerPrefs.Save() if you specifically want it to save at other times.
In an options menu or similar Iâd consider calling Save after every change.
Thank you. This is why I randomly read forums. I had not even thought of this. I just used playerprefs without further investigation. It worked for me and I never thought about it again. I will amend my practices to reflect my newfound knowledge.
From unity manual
By default Unity writes preferences to disk during OnApplicationQuit(). In cases when the game crashes or otherwise prematuraly exits, you might want to write the PlayerPrefs at sensible âcheckpointsâ in your game. This function will write to disk potentially causing a small hiccup, therefore it is not recommended to call during actual gameplay.
Honestly, itâs called PlayerPrefs, I wouldnât expect people to call it during gameplay anyway.
Given the nature of Unity and the context of many users, I think thatâs one place where the manual could benefit people by giving a clear reminder that we have a full .NET environment at our disposal, including various file IO and related tools. It would probably save many of the cases Iâve seen where people struggle to shove inappropriate stuff into PlayerPrefs because they think thatâs just what Unity uses for saved data in general.