结果是对的,但就是每4贞就警告一次
Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak,
public class JobTest : MonoBehaviour
{
[ReadOnly]
NativeArray<float> result;
Myjob job;
JobHandle handle;
float testFloat;
private void Start()
{
result = new NativeArray<float>(1, Allocator.Persistent);
job = new Myjob();
job.a = 5f;
job.b = 6f;
job.array = result;
handle = job.Schedule();
handle.Complete();
testFloat = result[0];
result.Dispose();
Debug.Log(testFloat);
}
}
google也没个结果,直接无视么?