Author Topic: Invisible Button in 2.6.4  (Read 3490 times)

duncanx

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Invisible Button in 2.6.4
« on: May 02, 2014, 11:00:41 AM »
I am using NGUI 2.6.4 (upgrading this particular project has been too difficult). Anyway I need a button that you can't see, that stretches across the whole screen. Previous I have been using a solid white sprite that I set transparency to 0 on for this. But I worry that I'm paying a cost for that. In recent versions of NGUI this is easily solved, but in 2.6.4 is not very obvious. If I just stick a collider on gameobject...it won't work...unless there is some sprite in there somewhere. I have found 2 ways...

1: use the typical sprite with collider with uistretch approach, but set the sprite's atlas to null. This seems to work.
2: use a label, uistretch, collider, set font to null. This also seems to work.

Are either or both of those ok? Is there a better way (that works in 2.6.4)?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Invisible Button in 2.6.4
« Reply #1 on: May 04, 2014, 10:26:52 AM »
Any collider is capable of receiving events in NGUI. It doesn't need to be a widget. In NGUI 2, create a box collider and adjust its size. To determine if it's in front or not, adjust its Z position.