Author Topic: UIInput is not deselected when a cancel key is pressed  (Read 23625 times)

wizardsmoke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 5
  • Posts: 40
    • View Profile
UIInput is not deselected when a cancel key is pressed
« on: June 10, 2016, 05:51:18 PM »
Hello,

When pressing a cancel key (set in UICamera), the currently selected UIInput is not deselected.  I set a breakpoint in UIInput.OnKey, but the breakpoint was never hit when pressing the cancel key.  This behavior can be reproduced in the Chat Window example scene (Example 12) in NGUI 3.9.8.

Please let me know what I should do fix this issue.

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput is not deselected when a cancel key is pressed
« Reply #1 on: June 12, 2016, 03:04:37 AM »
UICamera.controllerNavigationObject's getter ends with:
  1. controller.current = null;
  2. return null;
Change it to:
  1. controller.current = selectedObject;
  2. return controller.current;

wizardsmoke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 5
  • Posts: 40
    • View Profile
Re: UIInput is not deselected when a cancel key is pressed
« Reply #2 on: June 13, 2016, 08:35:08 AM »
Thanks for your reply.

I changed the code as instructed, but the behavior that I described remains unchanged.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput is not deselected when a cancel key is pressed
« Reply #3 on: June 13, 2016, 08:35:55 AM »
Thanks for your reply.

I changed the code as instructed, but the behavior that I described remains unchanged.
Seems to work properly here. I rolled the same change into 3.9.9. I run the example 12, click on the input field to select it, hitting Escape removes the selection.

wizardsmoke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 5
  • Posts: 40
    • View Profile
Re: UIInput is not deselected when a cancel key is pressed
« Reply #4 on: June 13, 2016, 09:08:58 AM »
Seems to work properly here. I rolled the same change into 3.9.9. I run the example 12, click on the input field to select it, hitting Escape removes the selection.
Could this difference in behavior be caused by a difference in versions of Unity?  I am running Unity version 5.3.4p6.

wizardsmoke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 5
  • Posts: 40
    • View Profile
Re: UIInput is not deselected when a cancel key is pressed
« Reply #5 on: June 13, 2016, 02:30:35 PM »
While I was testing, I found that the UIInput in Example 12 worked properly after the Debug checkbox on UICamera was checked, such that the following behavior was observed:

1) Press the Play button with Debug unchecked.
2) Click on the input field and press escape.  The input field remains selected.
3) Check the Debug checkbox.
4) Click on the input field and press escape.  The input field is deselected.
5) Uncheck the Debug checkbox.
6) Click on the input field and press escape.  The input field is deselected.

When you tested this, did you have Debug checked?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput is not deselected when a cancel key is pressed
« Reply #6 on: June 16, 2016, 03:30:45 AM »
No, I didn't. I'm on Unity 5.3.5.