Author Topic: full screen button not working in build  (Read 2286 times)

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
full screen button not working in build
« on: May 19, 2014, 04:51:11 PM »
I have a full screen button to block the game screen when menus appear. In one instance I have it set so you can "click anywhere" to continue.

It's working perfectly in the editor, but in Web and PC builds, the button doesn't work. It lets me click things behind it, and for the "click anywhere" instance it doesn't detect a hit so the game just continues behind it.

I know it's activating because its children (the menus) appear. Buttons on the menus work.

UIButton is on a UIWidget parented and anchored to the UIRoot. The box collider is set to auto-adjust size.

I wondered if it was anything to do with its Z size being 0, but with auto-adjust size I can't change that.

Any ideas?

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: full screen button not working in build
« Reply #1 on: May 19, 2014, 04:55:30 PM »
Ok, my post gave me an idea. i tested without auto-adjust on the box collider size, and it worked at Z size of 10.

I'm assuming I need the auto-size to accommodate different resolutions. Is there a way to make the box collider autosize, but keep the Z value?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: full screen button not working in build
« Reply #2 on: May 19, 2014, 05:05:44 PM »
Z size should just be 0, and the localScale of the transform should also just be 1,1,1.

Since you don't have anything defining depth on it, it will be placed at 0, which means it generally will work "sometimes". This of course sucks. Attach a UIWidget to the fullscreen button at the collider level and anchor it to the sides with the anchor on the UIWidget. With a UIWidget you also get a depth setting that will ensure it works as intended.

If this doesn't work, then I might have misunderstood something. Please post your precise structure of the button in that case.

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: full screen button not working in build
« Reply #3 on: May 19, 2014, 06:40:38 PM »
Thanks Nicki,

I'm not sure what that means to attach a UIWidget at the collider level. I couldn't see a depth setting on the UI Widget.

I have:
UI Root (3d)
   Camera at 0,0, -700
   FullScreenButton at 0,0,0 - UIWidget achored to UI Root (3d), Box Collider (auto-adjust to widget), UIButton.
     Menu Sprite
       Other Labels and buttons

Since my web and PC builds are a lower resolution, I'm wondering if the z size of the collider is maybe scaling to less than 0 somehow (that made more sense in my head before I wrote it).

Quick test confirms it also works at Z size of 0 as long as auto-adjust is turned off.

Edited to add: The Depth value of the Widget, of course sorry. That is set to 10, with other buttons within the menu set higher. All above the values of other game elements.
« Last Edit: May 19, 2014, 06:51:43 PM by kretin »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: full screen button not working in build
« Reply #4 on: May 20, 2014, 04:39:19 PM »
Hmm that's strange. Could you maybe post a unitypackage of your setup (without NGUI in the package)? Then I'll try it out and see if there's something iffy. :)