Search Unity

Custom ClipInspector with VisualElement ?

Discussion in 'UI Toolkit' started by Goooooooogle, Jul 18, 2019.

  1. Goooooooogle

    Goooooooogle

    Joined:
    Sep 30, 2016
    Posts:
    11
    Hi,

    I am trying to create a custom editor for my special PlayableAsset class (timeline clip) but I haven't been able to make the element show up in the inspector when the clip is picked. Is this currently possible at all? Seems that UnityEditor.Timeline.ClipInspector by default calls OnInspectorGUI() to draw custom inspectors and CreateInspectorGUI is ignored.

    Thanks
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    Hello,

    It seems like this should work. Which Unity version are you using ?
     
  3. Goooooooogle

    Goooooooogle

    Joined:
    Sep 30, 2016
    Posts:
    11
    I am using 2019.1.5
     
  4. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    Can you report a bug please?
     
  5. Goooooooogle

    Goooooooogle

    Joined:
    Sep 30, 2016
    Posts:
    11
    Just did. (Case 1171296)
     
  6. bsymon

    bsymon

    Joined:
    Dec 11, 2016
    Posts:
    18
    Sorry to bump this thread, but I just tried to use UIElement for a clip inspector, and it's not working. I've checked the source of ClipInspector.cs in Timeline package, and in fact UIElement are not supported for clip inspector.
     
  7. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
  8. Goooooooogle

    Goooooooogle

    Joined:
    Sep 30, 2016
    Posts:
    11
    Is there any workaround for this while we wait for the feature to be implemented? Would it be possible to wrap an VisualElement inside IMGUI? We have UIElements that we want to reuse for Timeline clips.
     
    fxlange likes this.
  9. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    UIElements cannot run inside IMGUI and we don't plan to add support for such a case. Best option would be to overlay it using absolute position and the rectangle information from IMGUI.
     
  10. bsymon

    bsymon

    Joined:
    Dec 11, 2016
    Posts:
    18
    Yes but the inverse is possible, you can wrap a IMGUI inside a VisualElement, with IMGUIContainer. I did a quick test modifying the code of ClipInspector in Timeline, and I could display all clip inspector inside the CreateInspectorGUI().
     
    Goooooooogle and uDamian like this.