Search code examples
unity-game-enginescrollview

How to scroll Unity ScrollView without Bg Image?


I am in trouble with Image(Canvas Renderer) and Line Renderer both using in Unity ScrollView.

It's look like;

without bg image enter image description here

But Now I can't scroll down or up with hold from free spaces(gray color) because There is no background raycast target object like image or button. But I can scroll with hold from level nodes.

I want to scroll with hold from anywhere from screen so I added an Image object in scrollview content. But this time line renderer came up, However z index order like this.

---level nodes z:-10 --line renderer z:0 -image object z:10

It look like now: (red area is imageview)

enter image description here

I changed line renderer and object z index when running mode but nothing changed. But I disabled image object line renderer go down again.

So How can I scroll without Bg image or How can I draw lines with line renderer between Button and Image object's z index.

Last explanation I tried change Line Renderer positions' z index but nothing change.

enter image description here


Solution

  • I fixed issue using with Sorting Group component.

    I added Sorting Group component to Image and Lines gameobjects. And I setted property like this.

    enter image description here

    enter image description here

    enter image description here

    Result(I changed background image alpha=0):

    enter image description here