Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How do you make an element draw outside of its parent element's box?

Discussion in 'UI Toolkit' started by MasonWheeler, Oct 17, 2022.

  1. MasonWheeler

    MasonWheeler

    Joined:
    Apr 2, 2016
    Posts:
    210
    If we look at Shader Graph in the UIToolkit debugger, we see something strange. Here's an input port with its box highlighted:

    upload_2022-10-17_13-37-20.png

    And here's the PortInputView element (the X: 0 editor to the left of it) with its box highlighted:
    upload_2022-10-17_13-38-29.png

    This box is almost entirely outside of its parent box, but everything draws as expected.

    I'm trying to duplicate this effect in my own project. But when I try to show the editor element, nothing outside of the parent box gets drawn:
    upload_2022-10-17_13-41-14.png

    There has to be some style property somewhere that I'm missing, but I don't know what it is; even copying the Shader Graph stylesheet files wholesale into my project does not cause this to draw correctly. Does anyone know what it is that allows the editor element to draw outside of its parent's box?
     
  2. MasonWheeler

    MasonWheeler

    Joined:
    Apr 2, 2016
    Posts:
    210
    ...anybody? Someone here has to understand this stuff.
     
  3. oscarAbraham

    oscarAbraham

    Joined:
    Jan 7, 2013
    Posts:
    431
    Do you have the overflow style property set to visible in all the parent elements?
     
    SimonDufour likes this.
  4. MasonWheeler

    MasonWheeler

    Joined:
    Apr 2, 2016
    Posts:
    210
    No. But after looking at it in the UI debugger, that turned out to be the issue. In ShaderGraph, the VisualElement tagged #node-border has Overflow: Visible, while in my version it was Overflow: Hidden. Changing that makes it work. Thanks!
     
    SimonDufour likes this.