Files
TEngine/Assets/GameScripts/HotFix/GameLogic/Demo/Uni/README.md
ALEXTANG 7bf081269c Demo
Demo
2023-05-13 11:57:11 +08:00

37 lines
838 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# UniFramework.Pooling
一个功能强大的游戏对象池系统。
该系统依赖于YooAsset资源系统支持各类异步编程支持同步接口和异步接口。
```c#
using UnityEngine;
using YooAsset;
using UniFramework.Pooling;
IEnumerator Start()
{
// 初始化游戏对象池系统
UniPooling.Initalize();
// 创建孵化器
var spawner = UniPooling.CreateSpawner("DefaultPackage");
// 创建Cube预制体的对象池
var operation = spawner.CreateGameObjectPoolAsync("Cube.prefab");
yield return operation;
// 孵化Cube游戏对象
SpawnHandle handle = spawner.SpawnAsync("Cube.prefab");
yield return handle;
Debug.Log(handle.GameObj.name);
// 回收游戏对象
handle.Restore();
// 丢弃游戏对象
handle.Discard();
}
```