diff options
author | tylermurphy534 <tylermurphy534@gmail.com> | 2022-11-06 15:12:42 -0500 |
---|---|---|
committer | tylermurphy534 <tylermurphy534@gmail.com> | 2022-11-06 15:12:42 -0500 |
commit | eb84bb298d2b95aec7b2ae12cbf25ac64f25379a (patch) | |
tree | efd616a157df06ab661c6d56651853431ac6b08b /VRCSDK3AvatarsLegacy/Assets/VRCSDK/Dependencies/Oculus/Spatializer/Scripts/ONSPSettings.cs | |
download | unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.gz unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.bz2 unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.zip |
move to self host
Diffstat (limited to 'VRCSDK3AvatarsLegacy/Assets/VRCSDK/Dependencies/Oculus/Spatializer/Scripts/ONSPSettings.cs')
-rw-r--r-- | VRCSDK3AvatarsLegacy/Assets/VRCSDK/Dependencies/Oculus/Spatializer/Scripts/ONSPSettings.cs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/VRCSDK3AvatarsLegacy/Assets/VRCSDK/Dependencies/Oculus/Spatializer/Scripts/ONSPSettings.cs b/VRCSDK3AvatarsLegacy/Assets/VRCSDK/Dependencies/Oculus/Spatializer/Scripts/ONSPSettings.cs new file mode 100644 index 00000000..de9c0c19 --- /dev/null +++ b/VRCSDK3AvatarsLegacy/Assets/VRCSDK/Dependencies/Oculus/Spatializer/Scripts/ONSPSettings.cs @@ -0,0 +1,55 @@ +using UnityEngine; +using System.Collections; + +#if UNITY_EDITOR +[UnityEditor.InitializeOnLoad] +#endif +public sealed class ONSPSettings : ScriptableObject +{ + [SerializeField] + public int voiceLimit = 16; // very conservative fallback + + private static ONSPSettings instance; + public static ONSPSettings Instance + { + get + { + if (instance == null) + { +#if UNITY_ANDROID + instance = Resources.Load<ONSPSettings>("ONSPSettings-Android"); +#else + instance = Resources.Load<ONSPSettings>("ONSPSettings"); +#endif + + // This can happen if the developer never input their App Id into the Unity Editor + // and therefore never created the OculusPlatformSettings.asset file + // Use a dummy object with defaults for the getters so we don't have a null pointer exception + if (instance == null) + { + instance = ScriptableObject.CreateInstance<ONSPSettings>(); + +#if UNITY_EDITOR + // Only in the editor should we save it to disk + string properPath = System.IO.Path.Combine(UnityEngine.Application.dataPath, "Resources"); + if (!System.IO.Directory.Exists(properPath)) + { + UnityEditor.AssetDatabase.CreateFolder("Assets", "Resources"); + } + + string fullPath = System.IO.Path.Combine( + System.IO.Path.Combine("Assets", "Resources"), +#if UNITY_ANDROID + "ONSPSettings-Android.asset"); +#else + "ONSPSettings.asset"); +#endif + UnityEditor.AssetDatabase.CreateAsset(instance, fullPath); +#endif + } + } + + return instance; + } + } +} |