Search Unity

Bug (IN-25762) [1.0.0-pre.44] Enableable component causing critical bug

Discussion in 'NetCode for ECS' started by optimise, Dec 13, 2022.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Enableable component is really awesome feature but sadly it causing critical bug to my production project. I think this critical bug needs to be fixed asap that I believe it's affecting a lot of production projects. I would like to get the hotfix as soon as official figure out the fix. At editor everything working nicely and correctly. But when u just try build and run server runtime then editor as client connect to server, you will see the game will not working properly and spamming error. I try to list down as following:

    1) When a ghost child entity has Foo Enableable component with [GhostComponent(SendDataForChildEntity = true)] and [GhostEnabledBit] and another Bar Enableable component without [GhostComponent(SendDataForChildEntity = true)] and [GhostEnabledBit], the data at Foo Enableable component will fail to sync to client side. Let say at server Foo Enableable component set bool to true then at client side Foo Enableable component the bool will still forever set to false

    2) When a parent ghost entity has Foo Enableable component without [GhostComponent(SendDataForChildEntity = true)] and [GhostEnabledBit] and you set to disable at authoring baker, it's disable properly at editor but it's enable at runtime build that causing the entire system logic goes wrong and keep spawn spamming ghost entity until crash the runtime for my project

    3) This bug can reproduce at both editor and runtime. When a parent ghost entity has FooComponent that has int [GhostField] and its child entities have 3 Enableable components has bool [GhostField] with GhostComponent(SendDataForChildEntity = true)] and [GhostEnabledBit], FooComponent at client side sometimes will failed to sync int value properly that will suddenly become extremely large int value then back to normal again
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    Hey optimise, thank you for the detailed bug report. I'll jump on 1 and 3 now, and we're also checking to see if 2 is related to baking issues.
     
    optimise likes this.
  3. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    I've reproduced 1) by extending the `GhostSerializationTestsForEnableableBits` tests. With this I can make a fix. Thanks again!
     
    UniqueCode and optimise like this.
  4. vectorized-runner

    vectorized-runner

    Joined:
    Jan 22, 2018
    Posts:
    398
    How are you even using Netcode in a production project... I couldn't do anything because there's so little documentation. Hats off to you
     
  5. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    If you're happy to give it: We'd appreciate feedback on this (in a new thread), especially as we get closer to 1.0. Documentation, manuals, and samples are constantly being worked on. The next pre-release package and samples releases should be very comprehensive.
     
  6. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    The fix has landed, and will be in edit: an upcoming pre-release. I strongly recommend to anyone affected by this to wait for that release, as it also contains other fairly large fixes.
     
    Last edited: Jan 14, 2023
  7. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Sadly it's still not fixed at 1.0.0-pre.44 release. The error below is the EnableableComponent at child ghost entity that has NetworkTick data field but without any [GhostEnabledBit], [GhostComponent] and [GhostField]. Another EnableableComponent at parent ghost entity is also without any [GhostEnabledBit], [GhostComponent] and [GhostField] but dun have any data field that serves as a Tag component although not have error but it will cause client keep spamming entity that keep instantiate new ghost entity caused by the EnableableComponent not being disable properly at baker I believe.


    NullReferenceException: Object reference not set to an instance of an object
    at Unity.Entities.EntityComponentStore.GetComponentDataWithTypeRO (Unity.Entities.Entity entity, Unity.Entities.TypeIndex typeIndex, Unity.Entities.LookupCache& cache) [0x00001] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\EntityComponentStore.cs:1211
    at Unity.Entities.ComponentLookup`1[T].get_Item (Unity.Entities.Entity entity) [0x00028] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\Iterators\ComponentLookup.cs:240
    at xxx.OnUpdate (Unity.Entities.SystemState& state) [0x00235] in C:\Backend\Unity\Assets\Features\xxx.cs:66
    at xxx+__codegen__OnUpdate_0000009A$BurstDirectCall.Invoke (System.IntPtr self, System.IntPtr state) [0x0001f] in <5507fc111c204b8da4e6c02b1ae77bbf>:0
    at xxx.__codegen__OnUpdate (System.IntPtr self, System.IntPtr state) [0x00000] in <5507fc111c204b8da4e6c02b1ae77bbf>:0
    at Unity.Entities.SystemBaseRegistry.ForwardToManaged (System.IntPtr delegateIntPtr, Unity.Entities.SystemState* systemState, System.Void* systemPointer) [0x00008] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\SystemBaseRegistry.cs:357
    at Unity.Entities.SystemBaseRegistry.CallForwardingFunction (Unity.Entities.SystemState* systemState, Unity.Entities.UnmanagedSystemFunctionType functionType) [0x000a8] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\SystemBaseRegistry.cs:326
    at Unity.Entities.SystemBaseRegistry.CallOnUpdate (Unity.Entities.SystemState* systemState) [0x00001] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\SystemBaseRegistry.cs:369
    at Unity.Entities.WorldUnmanagedImpl+UnmanagedUpdate_000014CE$BurstDirectCall.Invoke (System.Void* pSystemState) [0x0001e] in <9189501699c743809d5d3ce98ef4f658>:0
    at Unity.Entities.WorldUnmanagedImpl.UnmanagedUpdate (System.Void* pSystemState) [0x00001] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\WorldUnmanaged.cs:810
    at Unity.Entities.WorldUnmanagedImpl.UpdateSystem (Unity.Entities.SystemHandle sh) [0x000a3] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\WorldUnmanaged.cs:895
    at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x00070] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\ComponentSystemGroup.cs:697
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    Unity.Debug:LogException(Exception) (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\Stubs\Unity\Debug.cs:19)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\ComponentSystemGroup.cs:708)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\ComponentSystemGroup.cs:661)
    Unity.Entities.SystemBase:Update() (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\SystemBase.cs:418)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\ComponentSystemGroup.cs:703)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\ComponentSystemGroup.cs:667)
    Unity.Entities.SystemBase:Update() (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\SystemBase.cs:418)
    Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at .\Library\PackageCache\com.unity.entities@1.0.0-pre.44\Unity.Entities\ScriptBehaviourUpdateOrder.cs:526)
     
  8. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    Ah, sorry to hear! Do you have a repro project or snippet?
     
  9. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Looks like my issue is similar to Occuros. I will try the hotfix or next new release first as mentioned at Occuros post.
     
  10. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    yes it may be due to the same thing.
     
    optimise likes this.