Author Topic: Problems with UIImageButton on iOS and persistent button after press  (Read 2103 times)

adamnorbury

  • Guest
Please note that I am a designer not a coder so you will have to bear with me as I work slowly!

I've used UIButton as I couldn't get UIImageButton to work on my iOS test device, do you know what may be the cause? it works perfectly in Unity with the mouse interaction, rollovers and click but not on the phone with tapping gestures.

Also if you I tap multiple times on the "Press to begin" button when it finally loads the next scene [My AR camera] it remembers these button taps which then fall on the "Back to menu" button forcing Unity to load the previous scene - going back to the menu.

Is there a way to disable the button input when it has been tapped once so that the other scene can load?

I've attached an image of what I want to achieve.
« Last Edit: May 29, 2013, 03:16:12 AM by adamnorbury »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Before calling LoadLevel, disable the UICamera component. This will disable events. Or just disable the collider on the button before calling LoadLevel. Same effect.

adamnorbury

  • Guest
Hi Aren

Thank you so much for taking the time to respond, I'm afraid I'll have to ask if you have a script or code snippet I can use to do this as I'm not all that familiar with C#

Did you have any thoughts as to why the UIImageButton may not be working on my iOS device?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
No, I don't know why UIImageButton wouldn't work. Perhaps you didn't set it up correctly -- did you set the sprites?

  1. void OnClick()
  2. {
  3.     UICamera.FindCameraForLayer(gameObject.layer).enabled = false;
  4.     Application.LoadLevel("your level");
  5. }