public void Setup()
        {
            AssetDatabase.DeleteAsset("Assets/XR");
            XRPackageInitializationBootstrap.BeginPackageInitialization();

            TestPackage pkg = new TestPackage();

            XRPackageMetadataStore.AddPackage(pkg);
            XRPackageInitializationBootstrap.InitPackage(pkg);
        }
예제 #2
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;
        }