Update basic sample

pull/51/head
hevinci 2022-11-19 18:34:31 +08:00
parent 77080b3934
commit 217d88beaa
1 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,7 @@ public class GameScene1 : MonoBehaviour
private readonly List<AssetOperationHandle> _cachedAssetOperationHandles = new List<AssetOperationHandle>(1000); private readonly List<AssetOperationHandle> _cachedAssetOperationHandles = new List<AssetOperationHandle>(1000);
private readonly List<SubAssetsOperationHandle> _cachedSubAssetsOperationHandles = new List<SubAssetsOperationHandle>(1000); private readonly List<SubAssetsOperationHandle> _cachedSubAssetsOperationHandles = new List<SubAssetsOperationHandle>(1000);
private readonly List<RawFileOperationHandle> _cachedRawFileOperationHandles = new List<RawFileOperationHandle>(1000);
private int _npcIndex = 0; private int _npcIndex = 0;
void Start() void Start()
@ -38,6 +39,12 @@ public class GameScene1 : MonoBehaviour
handle.Release(); handle.Release();
} }
_cachedSubAssetsOperationHandles.Clear(); _cachedSubAssetsOperationHandles.Clear();
foreach(var handle in _cachedRawFileOperationHandles)
{
handle.Release();
}
_cachedRawFileOperationHandles.Clear();
} }
void OnGUI() void OnGUI()
{ {
@ -176,7 +183,8 @@ public class GameScene1 : MonoBehaviour
var btn = CanvasRoot.transform.Find("load_rawfile/btn").GetComponent<Button>(); var btn = CanvasRoot.transform.Find("load_rawfile/btn").GetComponent<Button>();
btn.onClick.AddListener(() => btn.onClick.AddListener(() =>
{ {
var handle = YooAssets.LoadRawFileSync("config1"); RawFileOperationHandle handle = YooAssets.LoadRawFileSync("config1");
_cachedRawFileOperationHandles.Add(handle);
handle.Completed += OnRawFile_Completed; handle.Completed += OnRawFile_Completed;
}); });
} }