Search Unity

Buggy ObjectField and object picking in general

Discussion in 'UI Toolkit' started by aybeone, Feb 4, 2019.

  1. aybeone

    aybeone

    Joined:
    May 24, 2015
    Posts:
    107
    Bug:

    There is a bug in ObjectField:
    • pick one object in it but None, close it
    • start picking another object but press Esc
    • the operation should be canceled but in fact None is returned !
    Pressing Esc is supposed to cancel the picking operation instead of returning a null object.

    Feature:

    The other thing related to object picking is ObjectSelector, I believe it should be made public since it's very convenient to use when you want to show an object picker from code. Sadly, the list of allowed IDs is not implemented, that would have allowed to filter out the list of presented objects.

    PS I have been able to fix the aforementioned bug by directly implementing my own object field UIElement which would in turn invoke ObjectSelector, which in turn would only update the binding-path when the picked object is not null (OnClosed parameter). TL;DR; boring but effective fix to the bug in ObjectField.

    Thanks !

    bug report: https://fogbugz.unity3d.com/default.asp?1123688_nlhoeqqq161dfc2k
     
    Last edited: Feb 4, 2019
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Thanks for the bug report and suggestion. The suggestion has been noted. That would indeed be useful.