性能优化与检测, 防止假死机

This commit is contained in:
2025-12-09 15:12:25 +08:00
parent 5ab19e39f2
commit eebf283e12
6 changed files with 66 additions and 18 deletions

View File

@@ -77,11 +77,11 @@ namespace Demo.Game
}
protected override IEnumerator LoadFromImptCacheFile(ToolFile cacheFile)
{
using var stream = File.OpenWrite(cacheFile.GetFullPath());
using var stream = File.OpenRead(cacheFile.GetFullPath());
using var reader = new BinaryReader(stream);
int length = reader.ReadInt32();
Datas = new NativeArray<float>(length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
for (int i = 0; i < length; i++)
Count = reader.ReadInt32();
Datas = new NativeArray<float>(Count, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
for (int i = 0; i < Count; i++)
{
Datas[i] = reader.ReadSingle();
}