Author Topic: Can't click from the Unity GUI  (Read 6606 times)

ggibellato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Can't click from the Unity GUI
« on: September 19, 2014, 02:30:22 PM »
Hi

I finally make work the NGUI/HudText on my game but I have a very strange behavior.

When I use the build version of the game all works fine but when I run from the Unity GUI I can't click in anything.

I turn the UICamera debug option and it shows Last Hit: UI Root, even before I click my mouse.

Can you help?

Thank you
Gleison

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't click from the Unity GUI
« Reply #1 on: September 19, 2014, 08:37:22 PM »
UIRoot is the fall through object, shown if nothing else is hit.

What do you mean by "I run from the Unity GUI"? What Unity GUI?

ggibellato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Can't click from the Unity GUI
« Reply #2 on: September 20, 2014, 05:15:24 AM »
Hi ArenMook

What I mean is

If I run the .exe generated by Unity it works fine, but I run from the Unity play button I can't click.

Thank you


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't click from the Unity GUI
« Reply #3 on: September 20, 2014, 09:36:15 AM »
Make sure your UICamera's event type is set to UI, not world. Which colliders do you use? 2D or 3D?

ggibellato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Can't click from the Unity GUI
« Reply #4 on: September 20, 2014, 01:27:42 PM »
Attached how is my camera, but at these point is
EventType = 2D UI
EventMask = Background Image (should I change to UI as the only thing I want is to use HudText?)

Most of the colliders are  Box Coliders, but in same cases I have it with some z what I believe make it 3D

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't click from the Unity GUI
« Reply #5 on: September 21, 2014, 08:58:58 AM »
You need to stick to one type of colliders. You chose 2D UI event type with your camera, meaning events will only be sent to Box Collider 2D types. If you're using Box Colliders (3D colliders!), then you should be using 3D UI type.

ggibellato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Can't click from the Unity GUI
« Reply #6 on: September 22, 2014, 04:30:20 AM »
I removed the UIRoot and re add now with 3D Ui but still the same problem.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't click from the Unity GUI
« Reply #7 on: September 22, 2014, 10:22:44 AM »
Try a brand new scene. That's about all i can suggest. There is no reason I can think of why it would work in the stand-alone build and not work when you hit Play. Unless your Unity itself is screwed up, which I find unlikely for something like this.

ggibellato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Can't click from the Unity GUI
« Reply #8 on: September 22, 2014, 05:42:07 PM »
That works and I finally found the problem on my scene.

The main camera was changed, (I don't remember when or how) to Clear Flags = Depth Only, I changed to Skybox.

Also there was a Component: UICamera (Script) that was disabled that I removed leaving only the UICamera (Script) at the camera under the UI Root

Thank you for your help.