Author Topic: Detecting whether or not a UITexture is completely on screen?  (Read 4419 times)

duggo42

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
Hey Everyone,

I'm trying to make a draggable camera only active when the user has zoomed in enough that a particular UITexture no longer completely fits on the screen.  Is there a way to detect when any of the UITexture's edges are no longer visible by the camera?

Thanks in advance!

duggo42

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Detecting whether or not a UITexture is completely on screen?
« Reply #1 on: May 14, 2015, 05:17:21 PM »
Okay, I just attached a collider to it and used the collider's bounds to get this information through Camera.WorldToViewportPoint().

If anyone knows if it's possible just through NGUI functions, it'd be cool to hear.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Detecting whether or not a UITexture is completely on screen?
« Reply #2 on: May 14, 2015, 06:16:56 PM »
Have a look at UIPanel.IsVisible(a, b, c, d).

duggo42

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Detecting whether or not a UITexture is completely on screen?
« Reply #3 on: May 14, 2015, 06:43:44 PM »
Will do. Thanks!