Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug GhostDefaultOverridesModifier Exception with Update Components in Ghost Authoring Component

Discussion in 'NetCode for ECS' started by desertGhost_, Jun 25, 2021.

  1. desertGhost_


    Apr 12, 2018
    When using a GhostDefaultOverridesModifier I found that clicking the Update Components button in the Ghost Authoring Component will throw the following exception:

    NullReferenceException: Object reference not set to an instance of an object
    Unity.NetCode.Editor.GhostAuthoringComponentEditor.ExtractComponentInfo (UnityEngine.GameObject gameObject, Unity.NetCode.Editor.GhostAuthoringComponentEditor+SerializedComponentData& componentData) (at Packages/com.unity.netcode@0.6.0-preview.7/Editor/GhostAuthoringComponentEditor.cs:481)

    This exception is only thrown when the GhostDefaultOverridesModifier does not have a GhostFieldModifier defined for one or more fields for a component.

    Solution / Work around:
    Defining a GhostFieldModifier for all fields in a component fixes the issue. If you have a component you do not want to sync, then set GhostFieldAttribute.SendData to false.
  2. CMarastoni


    Unity Technologies

    Mar 18, 2020
    Either this or just add a null check in the ExtractComponentInfo method. The problem is already fixed in later NetCode versions (sorry, not available for the public yet)
    desertGhost_ likes this.