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 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 DownloadDependnecies_CanDownloadDependencies() { yield return(Init()); string label = AddressablesTestUtility.GetPrefabLabel("BASE"); AsyncOperationHandle op = m_Addressables.DownloadDependencies(label); yield return(op); 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)); }); }
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()); }
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(); }
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(); }
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(); }