Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

DOTS Custom Editor Windows

Discussion in 'Entity Component System' started by DreamersINC, Oct 24, 2019.

  1. DreamersINC

    DreamersINC

    Joined:
    Mar 4, 2015
    Posts:
    131
    Anyone has documentation, example code, or tuts or building editor windows that access entity components? I am working on an utility AI implementation and need a better way to debug states than debugging to console.
     
  2. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    224
    what about using entity debugger?
    window > analysis > entity debugger
     
  3. supron

    supron

    Joined:
    Aug 24, 2013
    Posts:
    67
    Entity debugger code is a great source of information. Basically you can use EditorWindow Update() function to query entities, read data and update UI. You can access all worlds and entity managers (usually World.Active is enough). Reading data at specific point of player loop update is also possible, but requires some tricky code (dedicated system with delegates, or additional data storage).
     
    Last edited: Oct 24, 2019
  4. DreamersINC

    DreamersINC

    Joined:
    Mar 4, 2015
    Posts:
    131
    Can't use entity debugger. My components have structs which arent displayed in the entity debugger.
    GetMoney, Robbing, ItemsOnHand are structs which hold variable for determine the utility score of the state
    upload_2019-10-24_21-58-15.png
     
  5. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Have you added a [Serializable] attribute to your structs?
     
  6. DreamersINC

    DreamersINC

    Joined:
    Mar 4, 2015
    Posts:
    131
    [Serializable] and [Serialiedfield]
     
  7. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    210
    I think it’s due to the type of data you have in those structs. Bool, int, float etc show in the inspector, but other stuff doesn’t. I have a TBool field that’s basically a byte that acts as a bool, and that one doesn’t show in the inspector. So if I were you I’d start by zeroing in the type that’s causing problems.
     
  8. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    224
    in this case probably you need to fork unity.properties package