Exemplo n.º 1
0
        public IEnumerator AccessSettings()
        {
            int frameCount = 0;

            string[] assets = new string[0] {
            };

            TestPackage pkg = new TestPackage();

            XRPackageMetadataStore.AddPluginPackage(pkg);
            XRPackageInitializationBootstrap.InitPackage(pkg);

            while (frameCount < 60)
            {
                yield return(null);

                frameCount++;
            }

            yield return(null);

            var metadata = XRPackageMetadataStore.GetMetadataForPackage("com.unity.xr.testpackage");

            Assert.IsNotNull(metadata);

            assets = AssetDatabase.FindAssets($"t:{metadata.settingsType}");
            Assert.IsTrue(assets.Length == 1);
            var assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);

            var instance = AssetDatabase.LoadAssetAtPath(assetPath, typeof(TestSettings));

            Assert.IsNotNull(instance);
        }
Exemplo n.º 2
0
        public void Setup()
        {
            AssetDatabase.DeleteAsset("Assets/XR");
            XRPackageInitializationBootstrap.BeginPackageInitialization();

            TestPackage pkg = new TestPackage();

            XRPackageMetadataStore.AddPluginPackage(pkg);
            XRPackageInitializationBootstrap.InitPackage(pkg);
        }
Exemplo n.º 3
0
        internal static void InitPackage(IXRPackage package)
        {
            var packageMetadata = package.metadata;

            if (packageMetadata == null)
            {
                Debug.LogError($"Package {package.GetType().Name} has a package definition but has no metadata. Skipping initialization.");
                return;
            }

            XRPackageMetadataStore.AddPluginPackage(package);

            if (!InitializePackageFromMetadata(package, packageMetadata))
            {
                Debug.LogWarning(
                    String.Format("{0} package Initialization not completed. You will need to create any instances of the loaders and settings manually before you can use the intended XR Plug-in Package.", packageMetadata.packageName));
            }
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            AssetDatabase.DeleteAsset("Assets/XR");

            AssetDatabase.CreateFolder("Assets", "XR");

            m_Settings      = ScriptableObject.CreateInstance <XRManagerSettings>() as XRManagerSettings;
            m_Settings.name = "Actual testable settings.";

            m_TestSettings         = ScriptableObject.CreateInstance <XRGeneralSettings>() as XRGeneralSettings;
            m_TestSettings.Manager = m_Settings;
            m_TestSettings.name    = "Standalone Settings Container.";

            m_TestSettingsPerBuildTarget = ScriptableObject.CreateInstance <XRGeneralSettingsPerBuildTarget>() as XRGeneralSettingsPerBuildTarget;
            m_TestSettingsPerBuildTarget.SetSettingsForBuildTarget(BuildTargetGroup.Standalone, m_TestSettings);

            var testPath = XRGeneralSettingsTests.GetAssetPathForComponents(s_TempSettingsPath);

            if (!string.IsNullOrEmpty(testPath))
            {
                AssetDatabase.CreateAsset(m_TestSettingsPerBuildTarget, Path.Combine(testPath, "Test_XRGeneralSettings.asset"));

                AssetDatabase.AddObjectToAsset(m_TestSettings, AssetDatabase.GetAssetOrScenePath(m_TestSettingsPerBuildTarget));

                AssetDatabase.CreateFolder(testPath, "Settings");
                testPath = Path.Combine(testPath, "Settings");
                AssetDatabase.CreateAsset(m_Settings, Path.Combine(testPath, "Test_XRSettingsManager.asset"));

                m_TestSettings.AssignedSettings = m_Settings;
                AssetDatabase.SaveAssets();
            }

            EditorBuildSettings.AddConfigObject(XRGeneralSettings.k_SettingsKey, m_TestSettingsPerBuildTarget, true);

            XRPackageInitializationBootstrap.BeginPackageInitialization();

            TestPackage pkg = new TestPackage();

            XRPackageMetadataStore.AddPluginPackage(pkg);
            XRPackageInitializationBootstrap.InitPackage(pkg);

            TestLoaderBase.WasAssigned   = false;
            TestLoaderBase.WasUnassigned = false;
        }