public IEnumerator AddressablesImpl_DownloadDependenciesAsync_CanDownloadDependenciesWithChainFromObjectList()
        {
            // Setup
            yield return(Init());

            if (TypeName == "BuildScriptFastMode" || TypeName == "BuildScriptVirtualMode")
            {
                Assert.Ignore($"Skipping test {nameof(AddressablesImpl_DownloadDependenciesAsync_CanDownloadDependenciesWithChainFromObjectList)} for {TypeName}");
            }

            List <object> deps = new List <object>();

            deps.Add(AddressablesTestUtility.GetPrefabLabel("BASE"));

            m_Addressables.hasStartedInitialization = false;
            AsyncOperationHandle op = m_Addressables.DownloadDependenciesAsync(deps, Addressables.MergeMode.Intersection, false);

            yield return(op);

            m_Addressables.hasStartedInitialization = true;

            // Test
            var wrapOp = op.Convert <IList <IAssetBundleResource> >();

            AssertDownloadDependencyBundlesAreValid(wrapOp);

            // Cleanup
            op.Release();
        }
        public IEnumerator AddressablesImpl_DownloadDependenciesAsync_CanDoWithChainKey()
        {
            // Setup
            if (TypeName == "BuildScriptFastMode" || TypeName == "BuildScriptVirtualMode")
            {
                Assert.Ignore($"Skipping test {nameof(AddressablesImpl_DownloadDependenciesAsync_CanDoWithChainKey)} for {TypeName}");
            }

            yield return(Init());

            string label = AddressablesTestUtility.GetPrefabLabel("BASE");

            m_Addressables.hasStartedInitialization = false;
            AsyncOperationHandle op = m_Addressables.DownloadDependenciesAsync(label, false);

            m_Addressables.hasStartedInitialization = true;
            yield return(op);

            // Test
            var wrapOp = op.Convert <IList <IAssetBundleResource> >();

            AssertDownloadDependencyBundlesAreValid(wrapOp);

            // Cleanup
            op.Release();
        }
        public IEnumerator DownloadDependnecies_AutoReleaseHandle_ReleasesOnCompletion()
        {
            yield return(Init());

            string label            = AddressablesTestUtility.GetPrefabLabel("BASE");
            AsyncOperationHandle op = m_Addressables.DownloadDependenciesAsync(label, true);

            yield return(op);

            Assert.IsFalse(op.IsValid());
        }
        public IEnumerator LoadResourceLocations_ValidKeyDoesNotThrow()
        {
            //Setup
            yield return(Init());

            //Test
            Assert.DoesNotThrow(() =>
            {
                m_Addressables.LoadResourceLocationsAsync(AddressablesTestUtility.GetPrefabLabel("BASE"), typeof(GameObject));
            });
        }
示例#5
0
        public IEnumerator DownloadDependnecies_CanDownloadDependencies()
        {
            yield return(Init());

            string label            = AddressablesTestUtility.GetPrefabLabel("BASE");
            AsyncOperationHandle op = m_Addressables.DownloadDependencies(label);

            yield return(op);

            op.Release();
        }
        public IEnumerator DownloadDependnecies_DoesNotRetainLoadedBundles_WithAutoRelease()
        {
            yield return(Init());

            int    bundleCountBefore = AssetBundle.GetAllLoadedAssetBundles().Count();
            string label             = AddressablesTestUtility.GetPrefabLabel("BASE");
            AsyncOperationHandle op  = m_Addressables.DownloadDependenciesAsync(label, true);

            yield return(op);

            Assert.AreEqual(bundleCountBefore, AssetBundle.GetAllLoadedAssetBundles().Count());
        }
示例#7
0
        public IEnumerator LoadAsset_WhenEntryExists_ReturnsAsset()
        {
            yield return(Init());

            string label = AddressablesTestUtility.GetPrefabUniqueLabel("BASE", 0);
            AsyncOperationHandle <GameObject> op = m_Addressables.LoadAsset <GameObject>(label);

            yield return(op);

            Assert.AreEqual(AsyncOperationStatus.Succeeded, op.Status);
            Assert.IsTrue(op.Result != null);
            op.Release();
        }
        public IEnumerator LoadAssetWithWrongType_WhenEntryExists_Fails()
        {
            yield return(Init());

            string label = AddressablesTestUtility.GetPrefabUniqueLabel("BASE", 0);
            AsyncOperationHandle <Texture> op = m_Addressables.LoadAssetAsync <Texture>(label);

            yield return(op);

            Assert.AreEqual(AsyncOperationStatus.Failed, op.Status);
            Assert.IsNull(op.Result);
            op.Release();
        }
示例#9
0
        public IEnumerator LoadAssets_InvokesCallbackPerAsset()
        {
            yield return(Init());

            string label             = AddressablesTestUtility.GetPrefabLabel("BASE");
            HashSet <GameObject> ops = new HashSet <GameObject>();
            var gop = m_Addressables.LoadAssets <GameObject>(label, x => { ops.Add(x); });

            yield return(gop);

            Assert.AreEqual(AddressablesTestUtility.kPrefabCount, ops.Count);
            for (int i = 0; i < ops.Count; i++)
            {
                Assert.IsTrue(ops.Contains(gop.Result[i]));
            }
            gop.Release();
        }
        public IEnumerator LoadAsset_ValidKeyDoesNotThrow()
        {
            //Setup
            yield return(Init());

            //Test
            AsyncOperationHandle handle = default(AsyncOperationHandle);

            Assert.DoesNotThrow(() =>
            {
                handle = m_Addressables.LoadAssetAsync <GameObject>(AddressablesTestUtility.GetPrefabLabel("BASE"));
            });
            yield return(handle);

            //Cleanup
            handle.Release();
        }
示例#11
0
        public IEnumerator LoadAsset_WhenPrefabLoadedAsMultipleTypes_ResultIsEqual()
        {
            yield return(Init());

            string label = AddressablesTestUtility.GetPrefabUniqueLabel("BASE", 0);
            AsyncOperationHandle <object>     op1 = m_Addressables.LoadAsset <object>(label);
            AsyncOperationHandle <GameObject> op2 = m_Addressables.LoadAsset <GameObject>(label);

            yield return(op1);

            yield return(op2);

            Assert.AreEqual(op1.Result, op2.Result);
            Assert.AreEqual(AsyncOperationStatus.Succeeded, op1.Status);
            Assert.AreEqual(AsyncOperationStatus.Succeeded, op2.Status);
            op1.Release();
            op2.Release();
        }
示例#12
0
        public IEnumerator CanLoadAssetsWithMultipleKeysMerged()
        {
            yield return(Init());

            List <object> keys = new List <object>()
            {
                AddressablesTestUtility.GetPrefabLabel("BASE"), AddressablesTestUtility.GetPrefabUniqueLabel("BASE", 0)
            };
            AsyncOperationHandle <IList <GameObject> > gop = m_Addressables.LoadAssets <GameObject>(keys, null, Addressables.MergeMode.Intersection);

            while (!gop.IsDone)
            {
                yield return(null);
            }
            Assert.IsTrue(gop.IsDone);
            Assert.AreEqual(AsyncOperationStatus.Succeeded, gop.Status);
            Assert.NotNull(gop.Result);
            Assert.AreEqual(1, gop.Result.Count);
            Assert.AreEqual(AsyncOperationStatus.Succeeded, gop.Status);
            m_Addressables.Release(gop);
        }
        public IEnumerator AddressablesImpl_DownloadDependenciesAsync_CanDownloadDependenciesFromKey()
        {
            // Setup
            yield return(Init());

            if (TypeName == "BuildScriptFastMode" || TypeName == "BuildScriptVirtualMode")
            {
                Assert.Ignore($"Skipping test {nameof(AddressablesImpl_DownloadDependenciesAsync_CanDownloadDependenciesFromKey)} for {TypeName}");
            }
#if ENABLE_CACHING
            Caching.ClearCache();
#endif
            string label            = AddressablesTestUtility.GetPrefabLabel("BASE");
            AsyncOperationHandle op = m_Addressables.DownloadDependenciesAsync(label);
            yield return(op);

            // Test
            AssertDownloadDependencyBundlesAreValid(op);

            // Cleanup
            op.Release();
        }
示例#14
0
 public virtual void DeleteTempFiles()
 {
     ResourceManager.ExceptionHandler = m_PrevHandler;
     AddressablesTestUtility.TearDown(TypeName, PathFormat, "BASE");
 }
示例#15
0
 public virtual void Setup()
 {
     AddressablesTestUtility.Setup(TypeName, PathFormat, "BASE");
 }
示例#16
0
 public override void DeleteTempFiles()
 {
     AddressablesTestUtility.TearDown("BuildScriptPackedMode", PathFormat, "BASE");
     AddressablesTestUtility.TearDown(TypeName, PathFormat, "BASE");
 }
示例#17
0
 public override void Setup()
 {
     AddressablesTestUtility.Setup("BuildScriptPackedMode", PathFormat, "BASE");
     AddressablesTestUtility.Setup(TypeName, PathFormat, "BASE");
 }
        public IEnumerator VerifyChainOpPercentCompleteCalculation()
        {
            //Setup
            yield return(Init());

            AsyncOperationHandle <GameObject> op = m_Addressables.LoadAssetAsync <GameObject>(AddressablesTestUtility.GetPrefabLabel("BASE"));

            //Test
            while (op.PercentComplete < 1)
            {
                Assert.False(op.IsDone);
                yield return(null);
            }
            Assert.True(op.PercentComplete == 1 && op.IsDone);
            yield return(op);

            //Cleanup
            op.Release();
        }