Beispiel #1
0
 // ReSharper disable once MemberCanBePrivate.Global
 // Has to be public to be found by Burst reflection
 public static void Execute(ref EventPtrReceiverJobData <T> data)
 {
     // ReSharper disable once ForCanBeConvertedToForeach
     // Burst doesn't support foreach
     for (var i = 0; i < data.EventData.Length; i++)
     {
         data.UserJob.Execute(data.EventData[i]);
     }
 }
Beispiel #2
0
        internal static unsafe JobHandle Schedule <T>(
            this T job,
            VisualScriptingEventSystem eventSystem,
            JobHandle inputDeps = default)
            where T : struct, IVisualScriptingEventPtrReceiverJob
        {
            var data = new EventPtrReceiverJobData <T>
            {
                UserJob   = job,
                EventData = eventSystem.Events
            };

            var handle     = eventSystem.AddJobHandleForProducer(inputDeps);
            var parameters = new JobsUtility.JobScheduleParameters(
                UnsafeUtility.AddressOf(ref data),
                ExecuteUserEventPtrReceiverJobs <T> .Initialize(),
                handle,
                ScheduleMode.Batched);

            return(JobsUtility.Schedule(ref parameters));
        }