Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug pre.47: Exceptions in inspector with ghost components

Discussion in 'NetCode for ECS' started by Richay, Mar 2, 2023.

  1. Richay

    Richay

    Joined:
    Aug 5, 2013
    Posts:
    75
    Since updating to pre.47, I'm seeing exceptions in the inspector when viewing gameobjects with ghost components. Note that everything still appears to work correctly at runtime.

    Opening an existing prefab with GhostAuthoringComponent and GhostAuthoringInspectionComponent shows this error:

    Code (CSharp):
    1. InvalidOperationException: The BlobAssetReference is null.
    2. Unity.Entities.BlobAssetReferenceData.ValidateNotNull () (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.47/Unity.Entities/Blobs.cs:281)
    3. Unity.Entities.BlobAssetReference`1[T].get_Value () (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.47/Unity.Entities/Blobs.cs:442)
    4. Unity.NetCode.Editor.EntityPrefabComponentsPreview.AddToComponentList (Unity.NetCode.Editor.BakedEntityResult parent, System.Collections.Generic.List`1[T] newComponents, Unity.NetCode.GhostComponentSerializerCollectionData collectionData, Unity.Entities.World world, Unity.Entities.Entity convertedEntity, System.Int32 entityIndex, Unity.Entities.BlobAssetReference`1[T] blobAssetReference) (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/EntityPrefabComponentsPreview.cs:177)
    5. Unity.NetCode.Editor.EntityPrefabComponentsPreview.CreateBakedEntityResult (Unity.NetCode.Editor.BakedGameObjectResult parent, System.Int32 entityIndex, Unity.Entities.World world, Unity.Entities.Entity convertedEntity, System.Boolean isLinkedEntity, Unity.Entities.BlobAssetReference`1[T] blobAssetReference) (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/EntityPrefabComponentsPreview.cs:135)
    6. Unity.NetCode.Editor.EntityPrefabComponentsPreview.CreatedBakedResultForPrimaryEntities (Unity.Entities.World world, System.Collections.Generic.Dictionary`2[TKey,TValue] bakedDataMap, Unity.NetCode.GhostAuthoringComponent authoringComponent, Unity.Entities.BakingSystem bakingSystem, System.Collections.Generic.HashSet`1[T] primaryEntitiesMap, Unity.Entities.BlobAssetReference`1[T] blobAssetReference) (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/EntityPrefabComponentsPreview.cs:81)
    7. Unity.NetCode.Editor.EntityPrefabComponentsPreview.BakeEntireNetcodePrefab (Unity.NetCode.GhostAuthoringComponent authoringComponent, System.Collections.Generic.Dictionary`2[TKey,TValue] bakedDataMap) (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/EntityPrefabComponentsPreview.cs:50)
    8. Unity.NetCode.Editor.GhostAuthoringComponentEditor.BakeNetCodePrefab (Unity.NetCode.GhostAuthoringComponent ghostAuthoring) (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/GhostAuthoringComponentEditor.cs:164)
    9. Unity.NetCode.Editor.GhostAuthoringInspectionComponentEditor.OnUpdate () (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/GhostAuthoringInspectionComponentEditor.cs:67)
    10. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <1ef2856add15407ab99fef0e978737e3>:0)
    And making a new gameobject with both components directly in a scene shows this error:

    Code (CSharp):
    1. ArgumentException: A component with type:Unity.NetCode.GhostPrefabMetaDataComponent has not been added to the entity. Entities Journaling may be able to help determine more information. Please enable Entities Journaling for a more helpful error message.
    2. Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.ComponentType componentType) (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.47/Unity.Entities/EntityComponentStoreDebug.cs:302)
    3. Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.TypeIndex componentTypeIndex) (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.47/Unity.Entities/EntityComponentStoreDebug.cs:324)
    4. Unity.Entities.EntityDataAccess.GetComponentData[T] (Unity.Entities.Entity entity) (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.47/Unity.Entities/EntityDataAccess.cs:1278)
    5. Unity.Entities.EntityManager.GetComponentData[T] (Unity.Entities.Entity entity) (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.47/Unity.Entities/EntityManager.cs:364)
    6. Unity.NetCode.Editor.EntityPrefabComponentsPreview.BakeEntireNetcodePrefab (Unity.NetCode.GhostAuthoringComponent authoringComponent, System.Collections.Generic.Dictionary`2[TKey,TValue] bakedDataMap) (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/EntityPrefabComponentsPreview.cs:48)
    7. Unity.NetCode.Editor.GhostAuthoringComponentEditor.BakeNetCodePrefab (Unity.NetCode.GhostAuthoringComponent ghostAuthoring) (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/GhostAuthoringComponentEditor.cs:164)
    8. Unity.NetCode.Editor.GhostAuthoringInspectionComponentEditor.OnUpdate () (at ./Library/PackageCache/com.unity.netcode@1.0.0-pre.47/Editor/Authoring/GhostAuthoringInspectionComponentEditor.cs:67)
    9. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <1ef2856add15407ab99fef0e978737e3>:0)
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    224
    Hey Richay! Thanks for the report. I believe this is a known issue that we were unable to push a fix for for the pre-release. Can you remove the GhostAuthoringInspectionComponent from that Prefab (if at all possible) please?

    EDIT: And is it reproducible in the same project you linked previously (via bug report)? Thanks.
    EDIT2: Please also reply/DM with the name of the reproducing Prefab too. :)
     
  3. Richay

    Richay

    Joined:
    Aug 5, 2013
    Posts:
    75
    Yup, removing GhostAuthoringInspectionComponent stops the BlobAsset exception. You can reproduce this in the same project with any of the prefabs inside the _Prefabs folder.
     
    NikiWalker likes this.
  4. Richay

    Richay

    Joined:
    Aug 5, 2013
    Posts:
    75
    So I rolled back my project to test on pre.15 for another issue, returned to pre.47, and now the GhostAuthoringInspectionComponent works.

    The exception was occurring even after multiple editor restarts, but before going from .15 to .47 the second time I wiped the library, which maybe resolved it?
     
  5. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    224
    Oh, interesting! Likely a Library caching issue then. Good to know, that'll help us repro & fix it.