- Home /
PlayerPrefs Plugin. error CS0103: The name `PlayerSettings' does not exist in the current context
When I tired to build my game it gave me these errors:
Assets/Plugins/PlayerPrefsPlugin/Editor/PlayerPrefsPro.cs(52,52): error CS0103: The name PlayerSettings' does not exist in the current context Assets/Plugins/PlayerPrefsPlugin/Editor/PlayerPrefsPro.cs(92,100): error CS0103: The name
PlayerSettings' does not exist in the current context
I think the problem is with my Unity libraries (or something). Would rebuilding/importing them somehow fix this?
PlayerSettings needs "using UnityEditor" to work. And you need to remove everything linked to the editor within your build using
#if UNITY_EDITOR
using UnityEditor;
#endif
...
#if UNITY_EDITOR
PlayerSettings...
#endif
Answer by Harinezumi · Oct 24, 2017 at 01:05 PM
PlayerSettings is in UnityEditor module, which is not available in builds. You need to use platform dependent compilation for the code that wants to use PlayerSettings, so that it is not used for builds.
Basically add before the first use of PlayerSettings add #if UNITY_EDITOR and when it is not used add #endif. But make sure that your logic is nicely separated and that you don't use any variables from the conditionally compiled block.
Btw, PlayerSettings contains data about how the application (the "Player") will be built, it has nothing to do with the human user, also called "player".
Answer by JDPowerTeam · Jun 21, 2020 at 10:54 AM
if UNITY_EDITOR
Application.OpenURL("https://play.google.com/store/apps/details?id=" + PlayerSettings.applicationIdentifier);
endif
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Using async/await operators in a WP8 plugin 1 Answer
How can I connect unity to my smart fox server plugin 1 Answer