Hi,
I have problem with Job System. I want to send many GameObject to to IJob struct but I cant to send input List and NativeList. I want to execute parts GameObject put to many threads, but I don’t know how.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Jobs;
using Unity.Collections;
using Unity.Burst;
public class carsAI : MonoBehaviour
{
public List<GameObject> objects; // -> sends only parts objects to execute
void Update ()
{
// how to gets parts from the list object and execute in to many threads
}
}
[BurstCompile]
public struct driveCar : IJob
{
private NativeList<GameObject> objectToJobs;
public void Execute()
{
foreach (GameObject c in objectToJobs) Debug.Log(c.name);
}
}