Code:
void OnUpdate()
{
var job1 = new();
var job1Handle = job1.ScheduleParallel(state.Dependency);
state.Dependency = new Job2() { Input = job1.Result }.ScheduleParallel(job1Handle);
}
unsafe struct Job1 : IJE
{
public float* Result;
void Execute(SomeICD value)
{
Result = (float*)UnsafeUtility.Malloc(1, 4, Allocator.TempJob);
*Result = 1;
}
}
unsafe struct Job2 : IJE
{
public float* Input;
void Execute(SomeICD value)
{
//Read the Input and do something.
}
}
I got NullReferenceException: Object reference not set to an instance of an object when trying to use *Input inside Job2.
Thanks for reading.