Collider for Gui Buttons
I have a ScrollRect that contains a panel, which contains the buttons I want to scroll through, so the parent level is as following;
ScrollRect
+ScrollRect.content
++Button(s)
What I want to do is to know when a button leaves the world boundaries of ScrollRect panel. I wanted to add box colliders on both game objects, a static rigidbody on buttons, and when a button would leave the trigger marked ScrollRect collider, I'd disable that button.
The problem is, I can't make the OnColliderExit,Enter,Stay methods work. What would I be doing wrong? Do both objects have to stay on the same level in the hierachy? Do I need a material to actually make it work?
Answer by victorbisaev · Jan 30, 2018 at 12:28 AM
Consider using math expressions to decide if a button left the ScrollRect boundaries like "if (scrollPos.y > button.y + button.height) then button has left the visible rectangle of the ScrollRect in up direction".
Your answer

Follow this Question
Related Questions
Locate _MainTex from a public shader and assign to instantiated prefab for GUI 1 Answer
OnCollisionEnter2d incoming object is the wrong type 0 Answers
Bounds and extents of a tilemap collider across differing y axes, Tilemap collider bounds 0 Answers
Editor Window 1 Answer
I don't know how to create a highscore gui text and display it at death screen 0 Answers