Hi, today I’m here to talk about a problem with my script (I don’t speak English well I’m using google translate, I hope you understand what I write …)
I’ll explain the problem that I currently have and that I can’t solve (my knowledge in C ++ is low, what little I know I learned from video tutorials).
I am creating a game for android and at the moment I have created a menu with various settings (graphic, audio, display etc etc).
I’ve for a week now, been trying to figure out how to use PlayerSettings.muteOtherAudioSources = true
The script works correctly when I run the game in the PC but when I compile the APK the unity console gives me these 4 errors
- Assets/-Script/InterfacciaUI/ImpostazioniUI.cs(201,31): error CS0103: The name `PlayerSettings’ does not exist in the current context
- Error building Player because scripts had compiler errors
- Build completed with a result of ‘Failed’
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179) - UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:194
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:97
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
Inside the ImpostazioniUI script I entered using UnityEditor;
The error line of code is simply this
if(mutaaudiofuorigioco==1) {PlayerSettings.muteOtherAudioSources=true;}
Looking for solutions on the internet I have tried various solutions and it seems that I will have to use another script via the Editor folder.
But now I have another problem, I would like to access the script functions inside the Editor folder, what can I do?
Or if there is another way, how can I get PlayerSettings.muteOtherAudioSources to work on android;
Is it possible or should I let it go?