Ejemplo n.º 1
0
    protected bool EnableLoader(string loaderTypeName, bool enable)
    {
        XRGeneralSettings settings = XRGeneralSettings.Instance;

        if (settings == null || settings.Manager == null)
        {
            return(false);
        }

        var instance = TestBaseSetup.GetInstanceOfTypeWithNameFromAssetDatabase(loaderTypeName);

        if (instance == null || !(instance is XRLoader))
        {
            return(false);
        }

        XRLoader loader = instance as XRLoader;
        bool     ret    = true;

#pragma warning disable CS0618
        if (enable)
        {
            settings.Manager.loaders.Add(loader);
        }
        else
        {
            ret = settings.Manager.loaders.Remove(loader);
        }
#pragma warning restore CS0618

        return(ret);
    }
Ejemplo n.º 2
0
    protected bool EnableLoader(string loaderTypeName, bool enable, BuildTargetGroup buildTargetGroup = BuildTargetGroup.Standalone)
    {
#if UNITY_EDITOR
        XRGeneralSettings settings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTargetGroup);
#else
        XRGeneralSettings settings = XRGeneralSettings.Instance;
#endif

        if (settings == null || settings.Manager == null)
        {
            return(false);
        }

        var instance = TestBaseSetup.GetInstanceOfTypeWithNameFromAssetDatabase(loaderTypeName);
        if (instance == null || !(instance is XRLoader))
        {
            return(false);
        }

        XRLoader loader = instance as XRLoader;
        bool     ret    = false;

        if (enable)
        {
            ret = settings.Manager.TryAddLoader(loader);
        }
        else
        {
            ret = settings.Manager.TryRemoveLoader(loader);
        }

        return(ret);
    }
Ejemplo n.º 3
0
    protected bool EnableLoader(string loaderTypeName, bool enable)
    {
        XRGeneralSettings settings = XRGeneralSettings.Instance;

        if (settings == null || settings.Manager == null)
        {
            return(false);
        }

        var instance = TestBaseSetup.GetInstanceOfTypeWithNameFromAssetDatabase(loaderTypeName);

        if (instance == null || !(instance is XRLoader))
        {
            return(false);
        }

        XRLoader loader = instance as XRLoader;
        bool     ret    = true;

        if (enable)
        {
            List <XRLoader> loaders = new List <XRLoader> {
                loader
            };
            settings.Manager.TrySetLoaders(loaders);
        }
        else
        {
            ret = settings.Manager.TryRemoveLoader(loader);
        }

        return(ret);
    }
Ejemplo n.º 4
0
    protected bool IsLoaderEnabledForTarget(BuildTargetGroup buildTargetGroup, string loaderTypeName)
    {
        if (buildTargetGroup != BuildTargetGroup.Standalone && buildTargetGroup != BuildTargetGroup.WSA)
        {
            return(false);
        }

#if UNITY_EDITOR
        XRGeneralSettings settings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTargetGroup);
#else
        XRGeneralSettings settings = XRGeneralSettings.Instance;
#endif

        if (settings == null || settings.Manager == null)
        {
            return(false);
        }

        var instance = TestBaseSetup.GetInstanceOfTypeWithNameFromAssetDatabase(loaderTypeName);
        if (instance == null || !(instance is XRLoader))
        {
            return(false);
        }

        XRLoader loader = instance as XRLoader;
        return(settings.Manager.activeLoaders.Contains(loader));
    }
Ejemplo n.º 5
0
    protected bool IsLoaderEnabledForTarget(string loaderTypeName)
    {
        XRGeneralSettings settings = XRGeneralSettings.Instance;

        if (settings == null || settings.Manager == null)
        {
            return(false);
        }

        var instance = TestBaseSetup.GetInstanceOfTypeWithNameFromAssetDatabase(loaderTypeName);

        if (instance == null || !(instance is XRLoader))
        {
            return(false);
        }

        XRLoader loader = instance as XRLoader;

        return(settings.Manager.activeLoaders.Contains(loader));
    }