Exemplo n.º 1
0
 public void Load()
 {
     Version                 = k_VersionString;
     IsARCoreRequired        = true;
     IsInstantPreviewEnabled = true;
     CloudServicesApiKey     = string.Empty;
     IosCloudServicesApiKey  = string.Empty;
     if (File.Exists(k_ProjectSettingsPath))
     {
         ARCoreProjectSettings settings = JsonUtility.FromJson <ARCoreProjectSettings>(
             File.ReadAllText(k_ProjectSettingsPath));
         Version                 = settings.Version;
         IsARCoreRequired        = settings.IsARCoreRequired;
         IsInstantPreviewEnabled = settings.IsInstantPreviewEnabled;
         CloudServicesApiKey     = settings.CloudServicesApiKey;
         IosCloudServicesApiKey  = settings.IosCloudServicesApiKey;
         IsIOSSupportEnabled     = settings.IsIOSSupportEnabled;
     }
     // Upgrades settings from v1.0.0 to v1.1.0
     if (Version.Equals("V1.0.0"))
     {
         IsInstantPreviewEnabled = true;
         Version = k_VersionString;
     }
     // Upgrades setting from v1.1.0 and v1.2.0 to v1.3.0.
     // Note: v1.2.0 went out with k_VersionString = v1.1.0
     if (Version.Equals("V1.1.0"))
     {
         IosCloudServicesApiKey = CloudServicesApiKey;
     }
 }
Exemplo n.º 2
0
        public void Load()
        {
            Version                 = GoogleARCore.VersionInfo.Version;
            IsARCoreRequired        = true;
            IsInstantPreviewEnabled = true;
            CloudServicesApiKey     = string.Empty;
            IosCloudServicesApiKey  = string.Empty;
            AndroidAuthenticationStrategySetting = AndroidAuthenticationStrategy.DoNotUse;
            IOSAuthenticationStrategySetting     = IOSAuthenticationStrategy.DoNotUse;

            string absolutePath = Application.dataPath + "/../" + _projectSettingsPath;

            if (File.Exists(absolutePath))
            {
                ARCoreProjectSettings settings = JsonUtility.FromJson <ARCoreProjectSettings>(
                    File.ReadAllText(absolutePath));
                foreach (FieldInfo fieldInfo in this.GetType().GetFields())
                {
                    fieldInfo.SetValue(this, fieldInfo.GetValue(settings));
                }
            }
            else
            {
                Debug.Log("Cannot find ARCoreProjectSettings at " + absolutePath);
            }

            if (!string.IsNullOrEmpty(CloudServicesApiKey))
            {
                AndroidAuthenticationStrategySetting = AndroidAuthenticationStrategy.ApiKey;
            }

            if (!string.IsNullOrEmpty(IosCloudServicesApiKey))
            {
                IOSAuthenticationStrategySetting = IOSAuthenticationStrategy.ApiKey;
            }

            // Upgrades settings from V1.0.0 to V1.1.0.
            if (Version.Equals("V1.0.0"))
            {
                IsInstantPreviewEnabled = true;
                Version = "V1.1.0";
            }

            // Upgrades setting from V1.1.0 and V1.2.0 to V1.3.0.
            // Note: V1.2.0 went out with _versionString = V1.1.0
            if (Version.Equals("V1.1.0"))
            {
                IosCloudServicesApiKey = CloudServicesApiKey;
                Version = "V1.3.0";
            }

            if (!Version.Equals(GoogleARCore.VersionInfo.Version))
            {
                Version = GoogleARCore.VersionInfo.Version;
            }
        }
 static ARCoreProjectSettings()
 {
     if (Application.isEditor)
     {
         Instance = new ARCoreProjectSettings();
         Instance.Load();
     }
     else
     {
         Instance = null;
         Debug.LogError("Cannot access ARCoreProjectSettings outside of Unity Editor.");
     }
 }
Exemplo n.º 4
0
        public void Load()
        {
            Version                 = k_VersionString;
            IsARCoreRequired        = true;
            IsInstantPreviewEnabled = false;

            if (File.Exists(k_ProjectSettingsPath))
            {
                ARCoreProjectSettings settings = JsonUtility.FromJson <ARCoreProjectSettings>(
                    File.ReadAllText(k_ProjectSettingsPath));
                Version          = settings.Version;
                IsARCoreRequired = settings.IsARCoreRequired;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Generate the AndroidManifest XDocument based on the ARCoreProjectSettings.
        /// This function would be used in Tests.
        /// </summary>
        /// <param name="settings">ARCore Project Settings.</param>
        /// <returns>The XDocument of the final AndroidManifest.</returns>
        public static XDocument GenerateCustomizedAndroidManifest(
            ARCoreProjectSettings settings)
        {
            XElement mergedRoot = GetDefaultAndroidManifest().Root;
            List <IDependentModule> featureModules = DependentModulesManager.GetModules();

            foreach (IDependentModule module in featureModules)
            {
                if (module.IsEnabled(settings))
                {
                    XDocument xDocument =
                        AndroidManifestMerger.TransferToXDocument(
                            module.GetAndroidManifestSnippet(settings));
                    mergedRoot = AndroidManifestMerger.MergeXElement(
                        mergedRoot, xDocument.Root);
                }
            }

            return(new XDocument(mergedRoot));
        }
Exemplo n.º 6
0
        private static void CheckCompatibilityWithAllSesssionConfigs(
            ARCoreProjectSettings settings,
            Dictionary <ARCoreSessionConfig, string> sessionToSceneMap)
        {
            List <IDependentModule> featureModules = DependentModulesManager.GetModules();

            foreach (IDependentModule module in featureModules)
            {
                foreach (var entry in sessionToSceneMap)
                {
                    if (!module.IsCompatibleWithSessionConfig(
                            settings, entry.Key))
                    {
                        throw new BuildFailedException(
                                  string.Format(
                                      "Module {0} isn't compatible with the setting in {1}",
                                      module.GetType().Name, entry.Value));
                    }
                }
            }
        }
        public void Load()
        {
            Version                 = k_VersionString;
            IsARCoreRequired        = true;
            IsInstantPreviewEnabled = true;

            if (File.Exists(k_ProjectSettingsPath))
            {
                ARCoreProjectSettings settings = JsonUtility.FromJson <ARCoreProjectSettings>(
                    File.ReadAllText(k_ProjectSettingsPath));
                Version                 = settings.Version;
                IsARCoreRequired        = settings.IsARCoreRequired;
                IsInstantPreviewEnabled = settings.IsInstantPreviewEnabled;
            }

            // Upgrades settings from v1.0.0 to v1.1.0
            if (Version.Equals("V1.0.0"))
            {
                IsInstantPreviewEnabled = true;
                Version = k_VersionString;
            }
        }
Exemplo n.º 8
0
        public void Load()
        {
            Version                 = GoogleARCore.VersionInfo.Version;
            IsARCoreRequired        = true;
            IsInstantPreviewEnabled = true;
            CloudServicesApiKey     = string.Empty;
            IosCloudServicesApiKey  = string.Empty;

            if (File.Exists(_projectSettingsPath))
            {
                ARCoreProjectSettings settings = JsonUtility.FromJson <ARCoreProjectSettings>(
                    File.ReadAllText(_projectSettingsPath));
                foreach (FieldInfo fieldInfo in this.GetType().GetFields())
                {
                    fieldInfo.SetValue(this, fieldInfo.GetValue(settings));
                }
            }

            // Upgrades settings from V1.0.0 to V1.1.0.
            if (Version.Equals("V1.0.0"))
            {
                IsInstantPreviewEnabled = true;
                Version = "V1.1.0";
            }

            // Upgrades setting from V1.1.0 and V1.2.0 to V1.3.0.
            // Note: V1.2.0 went out with _versionString = V1.1.0
            if (Version.Equals("V1.1.0"))
            {
                IosCloudServicesApiKey = CloudServicesApiKey;
                Version = "V1.3.0";
            }

            if (!Version.Equals(GoogleARCore.VersionInfo.Version))
            {
                Version = GoogleARCore.VersionInfo.Version;
            }
        }