Author Topic: Is UISprite rendered on screen (Or in screen bounds)  (Read 6371 times)

tonyM

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 24
    • View Profile
Is UISprite rendered on screen (Or in screen bounds)
« on: September 10, 2013, 05:53:25 PM »
Hi guys,

I have a moving sprite on screen.  Is there any way how I can check if it moved off screen bounds please?

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Is UISprite rendered on screen (Or in screen bounds)
« Reply #1 on: September 11, 2013, 08:01:27 AM »
NGUITools.CalculateAbsoluteWidgetBounds gives you the bounds. Get the min/max points and convert them to screen space. Check to see if they're both off-screen.

tonyM

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Is UISprite rendered on screen (Or in screen bounds)
« Reply #2 on: September 11, 2013, 03:45:43 PM »
Thanks for that.

Actually it was NGUIMath.CalculateAbsoluteWidgetBounds(go.transform);