Search Unity

Bug (IN-41882) [1.0.8] Enableable ghost component with specific attribute setup bug

Discussion in 'NetCode for ECS' started by optimise, May 17, 2023.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Get 2 similar errors spamming when run the game at editor when setup enableable ghost component to be like this.

    Code (CSharp):
    1. [GhostComponent(SendDataForChildEntity = true, SendTypeOptimization = GhostSendType.OnlyPredictedClients, OwnerSendType = SendToOwnerType.SendToOwner)]
    2. [GhostEnabledBit]
    3. public struct EnableableComponent : IComponentData, IEnableableComponent
    4. {
    5.     [GhostField]
    6.     public bool value;
    7. }


    InvalidOperationException: Read only 0 enable bits but expected to read exacly 152 for this ghost type
    Unity.NetCode.GhostUpdateSystem+UpdateJob.ValidateAllEnableBitsHasBeenRead (System.Int32 enableableMaskOffset, System.Int32 numEnableBits) (at ./Library/PackageCache/com.unity.netcode@1.0.8/Runtime/Snapshot/GhostUpdateSystem.cs:112)
    Unity.NetCode.GhostUpdateSystem+UpdateJob.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at ./Library/PackageCache/com.unity.netcode@1.0.8/Runtime/Snapshot/GhostUpdateSystem.cs:656)
    Unity.NetCode.GhostUpdateSystem+UpdateJob.Unity.Entities.IJobChunk.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at <b15b3fd2f41d4010833c117321d2eba0>:0)
    Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities@1.0.8/Unity.Entities/IJobChunk.cs:409)
    Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities@1.0.8/Unity.Entities/IJobChunk.cs:357)

    InvalidOperationException: Read only 0 enable bits but expected to read exacly 148 for this ghost type
    Unity.NetCode.GhostUpdateSystem+UpdateJob.ValidateAllEnableBitsHasBeenRead (System.Int32 enableableMaskOffset, System.Int32 numEnableBits) (at ./Library/PackageCache/com.unity.netcode@1.0.8/Runtime/Snapshot/GhostUpdateSystem.cs:112)
    Unity.NetCode.GhostUpdateSystem+UpdateJob.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at ./Library/PackageCache/com.unity.netcode@1.0.8/Runtime/Snapshot/GhostUpdateSystem.cs:656)
    Unity.NetCode.GhostUpdateSystem+UpdateJob.Unity.Entities.IJobChunk.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at <b15b3fd2f41d4010833c117321d2eba0>:0)
    Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities@1.0.8/Unity.Entities/IJobChunk.cs:409)
    Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities@1.0.8/Unity.Entities/IJobChunk.cs:357)
     
    Last edited: May 17, 2023
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    315
    Thanks for the report optimise! Please file this as a Unity bug report, and link the IN-XXX report here.

    Just to make sure I understand correctly:
    1. Will the component replicate correctly if any of these GhostComponentAttribute values are different?
    2. I.e. Is it a specific attribute value that causes this?
    3. If so, presumably the workaround is to comment out some of these GhostComponentAttribute nuances for the time being? Does that unblock you?
    4. Presumably this is 100% reproable immediately after entering playmode?
    It looks like another missed test-case. We'll get this patched. Thank you!
     
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    1) Ya. The component seems replicate correctly at owner predicted ghost at client
    2) 3) Ya, I change it back to [GhostComponent(SendDataForChildEntity = true)] then will fix the error spamming
    4) Yes. Basically it will spam errors when interpolated ghost inside ghost relevancy range and owner predicted ghost will start having difficulty to sync data like moving stuck there for sometime. And then when interpolated ghost out of range of ghost relevancy will stop error spamming and owner predicted ghost back to normal again.
     
  4. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    IN-41882. Sorry for late bug report.
     
    NikiWalker likes this.
  5. DatCong

    DatCong

    Joined:
    Nov 5, 2020
    Posts:
    87
    is there a hot fix for this?
     
  6. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    894
    No, it requires some replication fixes in the Netcode package. There is not an hot patch for it.
     
    DatCong likes this.
  7. DatCong

    DatCong

    Joined:
    Nov 5, 2020
    Posts:
    87
    hwww, thank for the anws ,seem like have to pause project for a while.
     
  8. DatCong

    DatCong

    Joined:
    Nov 5, 2020
    Posts:
    87
    is there a fix for this ?
     
  9. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    894
    we are fixing it, yes. We hope to release this soon
     
    DatCong likes this.
  10. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    315
    Note that you can work around this by simply commenting out these two arguments: `SendTypeOptimization = GhostSendType.OnlyPredictedClients, OwnerSendType = SendToOwnerType.SendToOwner`. When these fields use default values, this error does not occur. Commenting these out will slightly increase snapshot sizes, but my understanding is that it is not a blocking issue (especially during dev).

    EDIT: The fix for this is non-trivial, but as Cristian said, is being worked on yes.
     
    DatCong likes this.
  11. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,116
    Hello.
    is there a fix for this error ?