my vertical scroll view structure,
added the invisible widget to scroll it outside from the objects added to scroll view (according to your video tutorial)
Panel (depth 1)
|>Container (invisible widget) (with box collider and UIDrag scroll view)
UIScroll View (depth 2)
|>Grid
|>2d sprite (box collider and UIDrag scroll view)
|>2d sprite
|>2d sprite (box collider and UIDrag scroll view)
|>2d sprite
and more 10 sprite elements in same way.
if (Input.GetMouseButtonDown (0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, out hit))
{
if (hit.collider != null)
{
Debug.Log (hit.collider.name);
}
}
}
i have enabled Debug option in Camera.
Last Hit showing every component properly if it is sprite or container,
but the problem is, in code by raycast hit, for some sprite objects i'm getting hit but for some sprite objects i'm getting hit on container.
3-4 times created new scroll view, but problem remains as it is, only objects on which i was getting hit are changing.