protected override IEnumerator runTest()
        {
            BundleMount bundleMount  = loadAndMount("DependencyBundlesTest/main.unity3d", null, isDependency: false);
            BundleMount bundleMount2 = loadAndMount("DependencyBundlesTest/dep1.unity3d", new HashSet <BundleMount> {
                bundleMount
            }, isDependency: true);
            BundleMount bundleMount3 = loadAndMount("DependencyBundlesTest/dep2.unity3d", new HashSet <BundleMount> {
                bundleMount2, bundleMount
            }, isDependency: true);

            bundleMount.IsPinned = true;
            IntegrationTest.Assert(bundleMount.IsPinned, "DependencyBundlesTest/main.unity3d");
            IntegrationTest.Assert(bundleMount2.IsPinned, "DependencyBundlesTest/dep1.unity3d");
            IntegrationTest.Assert(bundleMount3.IsPinned, "DependencyBundlesTest/dep2.unity3d");
            bundleMount.IsPinned = false;
            IntegrationTest.Assert(!bundleMount.IsPinned, "DependencyBundlesTest/main.unity3d");
            IntegrationTest.Assert(bundleMount2.IsPinned, "DependencyBundlesTest/dep1.unity3d");
            IntegrationTest.Assert(bundleMount3.IsPinned, "DependencyBundlesTest/dep2.unity3d");
            bundleMount3.IsPinned = true;
            IntegrationTest.Assert(!bundleMount.IsPinned, "DependencyBundlesTest/main.unity3d");
            IntegrationTest.Assert(bundleMount2.IsPinned, "DependencyBundlesTest/dep1.unity3d");
            IntegrationTest.Assert(bundleMount3.IsPinned, "DependencyBundlesTest/dep2.unity3d");
            bundleMount.Unload(unloadAllLoadedObjects: true);
            bundleMount2.Unload(unloadAllLoadedObjects: true);
            bundleMount3.Unload(unloadAllLoadedObjects: true);
            yield break;
        }
Exemple #2
0
        protected override IEnumerator runTest()
        {
            string        key       = "embedded_asset_test";
            TextAsset     bundleTxt = Resources.Load <TextAsset>(key + ".unity3d");
            AssetBundle   bundle    = AssetBundle.LoadFromMemory(bundleTxt.bytes);
            BundleManager manager   = Content.BundleManager;
            BundleMount   mount     = manager.MountBundle(key, bundle);

            mount.IsPinned = true;
            if (!mount.IsPinned)
            {
                IntegrationTest.Fail("mount should be pinned");
            }
            yield return(new WaitForFrame(Math.Max(manager.UnmountFrameCount, manager.MonitorFrameFrequency) + 1));

            IntegrationTest.Assert(mount.IsMounted);
            IntegrationTest.Assert(manager.IsMounted(key));
            mount.Unload(unloadAllLoadedObjects: false);
        }
Exemple #3
0
        protected override IEnumerator runTest()
        {
            string      key       = "embedded_asset_test";
            TextAsset   bundleTxt = Resources.Load <TextAsset>(key + ".unity3d");
            AssetBundle bundle    = AssetBundle.LoadFromMemory(bundleTxt.bytes);
            BundleMount mount     = new BundleMount(bundle, "embedded_asset_test", null);

            if (mount.ActiveRequestCount != 0)
            {
                IntegrationTest.Fail("ActiveRequestCount should start at 0.");
            }
            AsyncAssetBundleRequest <TextAsset> requestA = mount.LoadAsync <TextAsset>("embeddedasseta", "embeddedasseta.txt");
            AsyncAssetBundleRequest <TextAsset> requestB = mount.LoadAsync <TextAsset>("embeddedasseta", "embeddedasseta.txt");

            if (mount.ActiveRequestCount != 1)
            {
                IntegrationTest.Fail("ActiveRequestCount should be at 1 after LoadAsync even if shared.");
            }
            bool finishedLoadingWasCalled = false;

            mount.EFinishedLoading += delegate
            {
                finishedLoadingWasCalled = true;
            };
            yield return(requestA);

            yield return(null);

            IntegrationTest.Assert(requestA == requestB);
            IntegrationTest.Assert(finishedLoadingWasCalled);
            TextAsset asset = requestA.Asset;

            IntegrationTest.Assert(asset != null);
            IntegrationTest.Assert(asset.text.StartsWith("embeddedasseta"));
            IntegrationTest.Assert(mount.ActiveRequestCount == 0);
            mount.Unload(unloadAllLoadedObjects: false);
        }