Job compile error when an additional component is added.

I have a Job that is running fine, but I need to add the Rotation component. When I do I get the following error:

The placement of the Rotation component does not affect the error. Meaning, I can place the Rotation component before or after any other component in the Struct and Execute and I still get the error.

I can also place any other component and still get that error

cannot convert from ‘ER3D_TrafficSystem’ to ‘Unity.Collections.NativeMultiHashMap<int, int>’ Assembly-CSharp C:\Users\ASUS\Desktop\Heartbeat City\Heartbeat City\Assets\HBC\Scripts\ER3D_TrafficSystem.cs 120

cannot convert from ‘Unity.Jobs.JobHandle’ to ‘int’ Assembly-CSharp C:\Users\ASUS\Desktop\Heartbeat City\Heartbeat City\Assets\HBC\Scripts\ER3D_TrafficSystem.cs 120

The struct is:

    [BurstCompile]
    [RequireComponentTag(typeof(ERAutoTag))]
    private struct AutoNavigationJob : IJobForEach<
        HoverCarLevelComponent,
        HoverCarSpeedComponent,
        CarRoadLaneIdentityComponent,
        CarRoadComponent,
        CarPositionComponent,
        Rotation,
        Translation>

The execute is:

public void Execute(
            ref HoverCarLevelComponent carLevel,
            ref HoverCarSpeedComponent carSpeed,
            ref CarRoadLaneIdentityComponent carRoadLaneIdentity,
            ref CarRoadComponent carRoad,
            ref CarPositionComponent carPosition,
            ref Rotation carRotation,
            ref Translation translation)

So, this seems odd. Is there a limit to the number of components added to a job?

Yes, 6 IIRC.

[ ]'s

1 Like

Yes the current limit is 6 for injobforeach. Look into ijobchunk as a solution

1 Like

Thank you both for that info, that is very helpful.

Have a great day