public static void SetStateMachine(ref AsyncUniTaskMethodBuilder builder, ref TStateMachine stateMachine) { if (!pool.TryPop(out var result)) { result = new AsyncUniTask <TStateMachine>(); } TaskTracker.TrackActiveTask(result, 3); builder.runnerPromise = result; // set runner before copied. result.stateMachine = stateMachine; // copy struct StateMachine(in release build). }
public static void SetStateMachine(ref TStateMachine stateMachine, ref IStateMachineRunnerPromise runnerPromiseFieldRef) { if (!pool.TryPop(out var result)) { result = new AsyncUniTask <TStateMachine>(); } TaskTracker.TrackActiveTask(result, 3); runnerPromiseFieldRef = result; // set runner before copied. result.stateMachine = stateMachine; // copy struct StateMachine(in release build). }