Search Unity

Entity Debugger, serialize custom data

Discussion in 'Entity Component System' started by sebas77, Oct 1, 2019.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    if I add a custom IComponentData, how can I be sure that its data is shown correctly in the entity debugger?
     
  2. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Last edited: Oct 2, 2019
  3. Deleted User

    Deleted User

    Guest

    What does your struct contain?
     
  4. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    ulong as data, plus several methods
     
  5. Deleted User

    Deleted User

    Guest

    Then it should be fine to serialize with [System.Serializable] on top of your custom struct.

    May I ask entities version / unity version?
     
  6. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    I added a try catch in the entity package and I was wrong, actually the type that crashes is

    BlobAssetReferenceData (in blobs.cs) when calling this method (modified by me)

    public TValue GetValue(ref TContainer container)
    {
    try
    {
    return (TValue) m_Info.GetValue(container);
    }
    catch
    {
    Debug.Log(typeof(TValue));
    Debug.Log(typeof(TContainer));

    return default;
    }
    }
     
  7. Deleted User

    Deleted User

    Guest

    Try to add this to your packages.json file and see if it fixes the issue. Other fix might be to change all the fields to internal.

    "com.unity.properties": "0.6.4-preview",
     
    sebas77 likes this.
  8. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    the crash seems to be fixed now, but the value of my struct is not show, only the name of the fields.