Search Unity

Resolved NetCode telling me I did not group systems together but I have

Discussion in 'NetCode for ECS' started by adammpolak, Jun 12, 2022.

  1. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    Code (CSharp):
    1. Ignoring invalid [UpdateBefore] attribute on InputResponseMovementSystem targeting Unity.Physics.Systems.BuildPhysicsWorld.
    2. This attribute can only order systems that are members of the same ComponentSystemGroup instance.
    3. Make sure that both systems are in the same system group with [UpdateInGroup(typeof(Unity.NetCode.PredictedPhysicsSystemGroup))],
    4. or by manually adding both systems to the same group's update list.
    5. UnityEngine.Debug:LogWarning (object)
    6. Unity.Debug:LogWarning (object) (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/Stubs/Unity/Debug.cs:15)
    7. Unity.Entities.ComponentSystemSorter:FindConstraints (System.Type,Unity.Entities.ComponentSystemSorter/SystemElement[]) (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/ComponentSystemSorter.cs:311)
    8. Unity.Entities.ComponentSystemGroup:GenerateMasterUpdateList () (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/ComponentSystemGroup.cs:358)
    9. Unity.Entities.ComponentSystemGroup:RecurseUpdate () (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/ComponentSystemGroup.cs:306)
    10. Unity.Entities.ComponentSystemGroup:RecurseUpdate () (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/ComponentSystemGroup.cs:315)
    11. Unity.Entities.ComponentSystemGroup:RecurseUpdate () (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/ComponentSystemGroup.cs:315)
    12. Unity.Entities.ComponentSystemGroup:RecurseUpdate () (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/ComponentSystemGroup.cs:315)
    13. Unity.Entities.ComponentSystemGroup:SortSystems () (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/ComponentSystemGroup.cs:452)
    14. Unity.NetCode.ClientServerBootstrap:CreateServerWorld (Unity.Entities.World,string,Unity.Entities.World) (at Library/PackageCache/com.unity.netcode@0.50.1-preview.19/Runtime/ClientServerWorld/ClientServerBootstrap.cs:316)
    15. Unity.NetCode.ClientServerBootstrap:CreateDefaultClientServerWorlds (Unity.Entities.World) (at Library/PackageCache/com.unity.netcode@0.50.1-preview.19/Runtime/ClientServerWorld/ClientServerBootstrap.cs:81)
    16. Unity.NetCode.ClientServerBootstrap:Initialize (string) (at Library/PackageCache/com.unity.netcode@0.50.1-preview.19/Runtime/ClientServerWorld/ClientServerBootstrap.cs:64)
    17. Unity.Entities.DefaultWorldInitialization:Initialize (string,bool) (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities/DefaultWorldInitialization.cs:133)
    18. Unity.Entities.AutomaticWorldBootstrap:Initialize () (at Library/PackageCache/com.unity.entities@0.50.1-preview.2/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:16)
    19.  
    But I do have the systems in the same group:

    Code (CSharp):
    1. [UpdateInWorld(TargetWorld.ClientAndServer)]
    2. [UpdateInGroup(typeof(PredictedPhysicsSystemGroup))]
    3. // want to change the Velocity BEFORE the physics is run (which happens after BuildPhysicsWorld)
    4. // so it is not like the input had no affect on the player for a frame), so we run before BuildPhysicsWorld
    5. [UpdateBefore(typeof(BuildPhysicsWorld))]
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    This is entities telling you you haven't put it in the right group on creation, not netcode.
    BuildPhysicsWorld doesn't exist in PredictedPhysicsSystemGroup, it exists in FixedStepSimulationSystemGroup

    Code (CSharp):
    1. [UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
    2. [UpdateBefore(typeof(StepPhysicsWorld))]
    3. [AlwaysUpdateSystem]
    4. public partial class BuildPhysicsWorld : SystemBase
    Netcode just moves it to PredictedPhysicsSystemGroup after creation in PredictedPhysicsSystemGroup.MovePhysicsSystems

    You need to target FixedStepSimulationSystemGroup and just let netcode move your system.
     
  3. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    I will try this out thank yoU!

    What is odd is that my previous approach worked on Mac but loading the project on Windows started generating these errors.