Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Inconsistent events for custom inspectors

Discussion in 'Authoring Dev Blitz Day 2023' started by DevDunk, Jan 25, 2023.

  1. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,879
    The events usable for custom inspectors are really hard to works with.
    The usage is unpredictable and not consistent.
    There also is little documentation on when EventType events do and don't call.

    An example is the MouseUp event.
    This is only called when clicking on empty space, or when clicking on reference fields. When opening or closing foldouts, or sliding a float value it does not call.

    If changing this will break certain Unity features, a new type called 'FinalizedChange' or whatever would be welcome. This way I can only call a function when the change of a value is done. That being opening a foldout, changing a variable, or when finishing changing a float (now I cannot read an event when the float change finished).

    Here is an issue of mine about this as well:
    https://issuetracker.unity3d.com/is...useup-is-ignored-when-used-on-variable-fields
     
  2. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    If the current event is used by a different control before it reaches your code, the type will be "Used." It is by design - you don't want events being used by multiple different controls.

    If you could share some code with an example of what you're trying to achieve I could help troubleshoot.
     
  3. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,879
    To get back to you quickly, here is my setup:

    I am making a custom LOD system.
    This consists of an array, which contains 2 floats (range and downscale).
    Every time the range is edited I want to sort the array from low to high. I also want to sort when the array is reordered (I can also use non-reorderable, but that looks less good imo).

    I can share code tomorrow if needed
     
  4. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,879
    Oh thanks!
    It would be great to see some more learning material for custom inspectors, etc. It's really hard to find what you are looking for without knowing the exact terms already.