コード例 #1
0
        async void AsyncAdd()
        {
            loading = true;
            int index  = dropdown.value;
            var r      = resourceInfo[index];
            var handle = await PrefabLoader.AsyncLoad(
                r.path,
                v => progress.text = string.Format("Loading {0:P2}", v));

            progress.text = string.Empty;
            r.gameObjects.Add(handle.Instantiate <GameObject>());
            UpdateInstanceCount();
            loading = false;
        }
コード例 #2
0
        async Task TestAsyncLoad()
        {
            List <GameObject> instances = new List <GameObject>();
            var prefabResource          = await PrefabLoader.AsyncLoad("Prefabs/CompleteLevelArt");

            instances.Add(prefabResource.Instantiate <GameObject>());
            instances.Add(prefabResource.Instantiate <GameObject>());
            AssetSystem.Instance.GarbageCollect();
            ResLog.Log("Instantiate Finish");
            await Awaiters.Seconds(5f);

            instances.ForEach(go => GameObject.Destroy(go));
            instances.Clear();
            ResLog.Log("Destroy Instances");
            await Awaiters.Seconds(3f);

            AssetSystem.Instance.GarbageCollect();
            ResLog.Log("Garbage Collect");
            await Awaiters.Seconds(5f);

            ResLog.Log("TestAsyncLoad Finish");
        }