Unity-UI-Extensions/com.unity.uiextensions

BUG: UI Line Connector Visual Issue when moving parent container

Opened this issue ยท 5 comments

Unity UI Extensions Bug Report

Describe the bug

When putting the line connector and the rectTransforms you are connecting in the same parent GameObject, If you move the parent, the line connector doubles its movement compared to the connected objects.

To Reproduce

  1. Create a parent RectTransform
  2. Place 2 RectTransforms to connect and a UI line renderer + UI line connector inside parent
  3. Connect line connector to the two RectTransforms
  4. Move parent container in a direction
  5. Observe parallax effect due to increased line movement in comparison to the 2 RectTransforms it connects

Expected behavior

Lines would move as normal in the same way as the RectTransforms it connects

Actual behavior

Line renderer + connector moves double compared to connected RectTransforms

Screenshots

N/A

Your Setup

  • Operation System:
    • Windows
    • MacOs
    • Linux
    • Other
  • Unity Version: 2021.3.19f
  • Unity UI Extensions Version
    • 2.2.7

Additional context

N/A

Thanks for the report @ferrouslights , will investigate.

Hi @ferrouslights , not sure if you are still tracking this issue as it has been a while, sorry about that.

So the root cause of your issue is the current limitation that the Line render component (currently) MUST remain at origin, it doesn't have to be within another Rect Transform (can be anywhere in the canvas scene, but preferably in its own component in the center of the canvas.

I had worked some time ago to account for the distance from origin, but the Unity rendering system does not make this easy.

The best resolution for now, is to have your LineRender(UI Connector) components in separate RectTransforms at 0,0,0

As shown below:
image

  • Container Line Renderer - Origin 0,0
  • Container - 262,63

I shall update the docs to make this clearer, and add a warning to the UI LineRenderer if its position moves from 0,0,0

Updated docs and the UILineRenderer to be more clear on how to create a UILineRenderer in the scene, which should only ever be positioned at (0,0,0), because Unity...

It was worth a shot -- thank you for checking! Love the package btw.

It's just a case of restructuring components in the scene, the "parent container" you mention simply doesn't need the Line COnnector/LIne Renderer, just move that to a separate GO parented to the canvas and positioned at (0,0,0).
The container with the objects that are connected can then be moved anywhere without issue.