WebXRSettings GetSettings()
        {
            WebXRSettings settings = null;

            // When running in the Unity Editor, we have to load user's customization of configuration data directly from
            // EditorBuildSettings. At runtime, we need to grab it from the static instance field instead.
#if UNITY_EDITOR
            UnityEditor.EditorBuildSettings.TryGetConfigObject <WebXRSettings>("WebXR.Settings", out settings);
#elif UNITY_WEBGL
            settings = WebXRSettings.Instance;
#endif
            return(settings);
        }
        public override bool Initialize()
        {
            WebXRSettings settings = GetSettings();

            if (settings != null)
            {
                Debug.Log($"Got WebXRSettings");
#if UNITY_WEBGL && !UNITY_EDITOR
                SetWebXRSettings(settings.ToJson());
#endif
                Debug.Log($"Sent WebXRSettings");
            }

            CreateSubsystem <WebXRSubsystemDescriptor, WebXRSubsystem>(sampleSubsystemDescriptors, typeof(WebXRSubsystem).FullName);
            return(WebXRSubsystem != null);
        }
        /// <summary>Override of <see cref="IPreprocessBuildWithReport"/></summary>
        /// <param name="report">Build report.</param>
        public void OnPreprocessBuild(BuildReport report)
        {
            // Always remember to cleanup preloaded assets after build to make sure we don't
            // dirty later builds with assets that may not be needed or are out of date.
            CleanOldSettings();

            WebXRSettings settings = null;

            EditorBuildSettings.TryGetConfigObject <WebXRSettings>("WebXR.Settings", out settings);
            if (settings == null)
            {
                return;
            }

            UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();

            if (!preloadedAssets.Contains(settings))
            {
                var assets = preloadedAssets.ToList();
                assets.Add(settings);
                PlayerSettings.SetPreloadedAssets(assets.ToArray());
            }
        }
 void Awake()
 {
     instance = this;
 }