- Home /
How to use PlayerSettings.bundleIdentifier in final build?
So I have the following in one of my scripts: Code (CSharp):
string bID = PlayerSettings.bundleIdentifier;
When I first tried to use it, I got the following error: Code (csharp):
error CS0103: The name `PlayerSettings' does not exist in the current context
In order to get rid of this error, I needed to add the following at the top of the script: Code (CSharp):
using Unity.Editor;
This works great in the Editor, but when I try to build for iOS I get the following error: Code (csharp):
error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?
So I tried wrapping it like this: Code (CSharp):
#if UNITY_EDITOR
using UnityEditor;
#endif
Still works in Editor just fine, but when I try to build for iOS I still get one of the above two errors.
I have searched forum but cannot figure out how to get around this.
If you cannot include "using Unity.Editor" then what is the point of even having something like PlayerSettings?
Any advice to get this working appreciated.
Thanks
Answer by Sohaib_techverx · Nov 06, 2020 at 11:21 AM
Hi,
I know this is an old post but did you find any solution for this?
Thanks, Sohaib
Your answer
Follow this Question
Related Questions
MMD How to export model and animations to Unity as 3rd person controller? 2 Answers
Changing Bundle Identifier crashed the App on start? 0 Answers
help -- cannot set bundle identifier values 2 Answers
how to disable android tv compatibility in player settings 2 Answers
How to get this string to change values for each button at runtime? 1 Answer