Search Unity

Is there any way to hide property of component in inspector of `Entity Debugger`?

Discussion in 'Entity Component System' started by quabug, Feb 22, 2020.

  1. quabug

    quabug

    Joined:
    Jul 18, 2015
    Posts:
    66
    I've created a component like:
    Code (CSharp):
    1.     public class InputActionAssetComponent : IComponentData
    2.     {
    3.         public InputActionAsset Value;
    4.     }
    5.  
    But it will crash the editor if I select an entity with this component, I guess the problem is some loop dependency in `InputActionAsset`? So I wondering if there's any way to hide this from debug view, as `HideInInspector` for regular inspector.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    Could try the good old, make it a property
     
  3. quabug

    quabug

    Joined:
    Jul 18, 2015
    Posts:
    66
    Ha, nice and easy. Thank you!
    The only drawback is now I have to write a proxy `MonoBehavior` instead of generated one by `GenerateAuthoringComponent`.
     
  4. Deleted User

    Deleted User

    Guest

    Try to mark the field as internal.
     
  5. quabug

    quabug

    Joined:
    Jul 18, 2015
    Posts:
    66
    Not working properly with `GenerateAuthoringComponent`, since non-public field not able to expose in inspector by `SerializeFieldAttribute`... But public field could be hide by `HideInInspectorAttribute`, hmmm.
     
  6. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    480
    The entity inspector needs to be displayed in a custom way, since the entity or any of its components are not attached to a particular UnityEngine.Object. What is currently used to draw the inspector doesn't look at the attributes at all.

    We expect to start working on a new inspector for entities very soon. We'll switch the backend from IMGUI to UIElements and we'll pack in a few more features in it, such as:
    • Support for built-in attributes (HideInInspector, InspectorName, etc.)
    • Support for custom inspectors and property drawers
    It's very inconvenient to have to opt-out of `GenerateAuthoringComponent` to simply hide a field. We'll make sure this is supported out of the box.
     
  7. Mockarutan

    Mockarutan

    Joined:
    May 22, 2011
    Posts:
    159
    Any update on this? In an earlier version of Entity Debugger I used "System.NonSerialized" to hide them from the inspector, but not from the Entity Debugger. With the latest entities 0.13.0-preview.24 and dots.editor 0.11.0-preview.3, non of those seem to work to hide only in the inspector.

    Edit: martinpa_unity
     
    Last edited: Nov 12, 2020
  8. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    480
    Hey @Mockarutan

    What do you mean by this? Are you trying to hide fields for a component of an entity?

    If that is the case, on the latest com.unity.dots.editor, you should be able to use
    [HideInInspector]
    on the fields you want hidden in the entity inspector.
     
    starikcetin likes this.
  9. Mockarutan

    Mockarutan

    Joined:
    May 22, 2011
    Posts:
    159
    Never mind, it worked exactly as I wanted, and as you described before. Did something wrong earlier. Thanks for the response!