Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Quarkism on December 09, 2013, 07:06:04 PM

Title: UI Input Selection
Post by: Quarkism on December 09, 2013, 07:06:04 PM
I have a custom input controller with full keyboard support (tab, left, right, ect). The scripts no longer work with the latest update (3.0.7 f1). Reading the release notes I notice that there was a change to selection (which might be related).

Quote
- DEL: OnHover is no longer sent via selection changes. Listen to OnSelect and check (UICamera.currentScheme == ControlScheme.Controller).


Here is an excerpt from my script

  1.  public void GoNext(InputChild child)
  2.         {
  3.             var ordered = Children.OrderBy(o => o.TabIndex);
  4.  
  5.             var next = ordered.FirstOrDefault(o => o.TabIndex > child.TabIndex) ?? ordered.FirstOrDefault();
  6.  
  7.             Debug.Log(next);
  8.            
  9.             UICamera.selectedObject = next == null ? null : next.gameObject;
  10.         }
  11.  

The Debug statement confirms that my code is selecting the correct next control, but the last line (where I pass it to NGUI selection) is not working. Please advise.
Title: Re: UI Input Selection
Post by: ArenMook on December 10, 2013, 01:11:29 AM
I'm not sure what your code does. UICamera.selectedObject call is delayed rather than immediate. The selection change takes place at a later time. Why not use UIButtonKeys btw?
Title: Re: UI Input Selection
Post by: Quarkism on December 10, 2013, 01:55:39 PM
I didnt like UIButtonKeys. The idea of selecting the next control for each control was tedious. Moreover mine is more robust supporting tabbing, cycling, adding / removing controls, other control types and input layers (Option Menu having input focus over the pause menu over gameplay).

Edit 1:

Ill review UIButtonKeys to see how you handle focus.... Hmm your handling focus the same as me.... My script was working last version. argh.


Edit 2:

I think I have it working. Frankly I`m not sure what I change, I just cleaned up my code. Thanks for your time regardless.

Edit 3 :

I resolved the issue. It was my own fault. I had a script that selected the dropdown on hover. It was also closing the dropdown on blur.