Unity Job system error: BackingField is not a value type. Job structs may not contain any reference types.

Just started using the Unity Job System.

I’m not really understanding the reference types you can use (if any) in the IJob struct.
Vector3 seem to work, so you can use some reference types.
I use a List(Vector3) and that seems to be giving me trouble.

After trying to schedule my job I get the following error:

InvalidOperationException: GenerateJob.<Rami>k__BackingField is not a value type. Job structs may not contain any reference types.
Unity.Jobs.LowLevel.Unsafe.JobsUtility.CreateJobReflectionData (System.Type type, Unity.Jobs.LowLevel.Unsafe.JobType jobType, System.Object managedJobFunction0, System.Object managedJobFunction1, System.Object managedJobFunction2) (at C:/buildslave/unity/build/Runtime/Jobs/ScriptBindings/Jobs.bindings.cs:96)
Unity.Jobs.IJobExtensions+JobStruct`1[T].Initialize () (at C:/buildslave/unity/build/Runtime/Jobs/Managed/IJob.cs:23)
Unity.Jobs.IJobExtensions.Schedule[T] (T jobData, Unity.Jobs.JobHandle dependsOn) (at C:/buildslave/unity/build/Runtime/Jobs/Managed/IJob.cs:36)

I don’t have a clue what “BackingField” is, but it sounds like an unusable reference type, and I didn’t explicitly declare a BackingField.

Can someone please explain to me what this error means, and if there is a way to resolve it.
Thanks!

You can use a Vector3 because its a struct which makes it not a reference type (structs are value types as described here: Classes, structs, and records in C# | Microsoft Learn).

I believe you want to use a NativeArray which can be seen in this example: https://docs.unity3d.com/Manual/JobSystemSchedulingJobs.html,You can use a Vector3 because its a struct which makes it not a reference type. I believe you want to use a NativeArray, an example may be seen here: https://docs.unity3d.com/Manual/JobSystemSchedulingJobs.html