Search Unity

[BUG 0.6.0-preview.7] Unable to toggle off PrefabType settings for GhostAuthoringComponents

Discussion in 'NetCode for ECS' started by BrendonSmuts, Feb 12, 2021.

  1. BrendonSmuts

    BrendonSmuts

    Joined:
    Jun 12, 2017
    Posts:
    86
    Looks like a glitch in GhostAuthoringComponentEditor.cs

    Around line 156 the new GhostPrefabType settings are initialized with the old ones:

    Code (CSharp):
    1. GhostPrefabType newPrefab = prefabType;
    A few lines below there is a call into a function ShowPrefabType that draws the GUI toggles. The issue here is that newPrefab is only modified when the option is being toggled on:

    Code (CSharp):
    1. if (EditorGUILayout.ToggleLeft("Server", (prefabType & GhostPrefabType.Server) != 0,
    2.                     GUILayout.ExpandWidth(false), GUILayout.MaxWidth(90)))
    3.                     newPrefab |= GhostPrefabType.Server;
    The end result is that the new prefab settings can only be whatever the previous settings are plus whichever toggles are being enabled.

    A workaround for this at the moment is to right click the component in the GhostAuthoringComponent Components list and select "Remove Component". This will disable all prefab types for this component and allow you to re-enable the ones you're interested in.
     
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    Thank you for reporting this. Can you please file a bug for this in Unitys integrated bug reporting tool?