Author Topic: UIInput.selected  (Read 4011 times)

Nseries

  • Guest
UIInput.selected
« on: June 11, 2013, 12:26:14 PM »
Hello, i have some problems with NGUI scripts. The simplest method to show what is, it is to open Example 12 scene. I can use chat, and when I click on any different widget then UIInput, and click on button Enter, the focus(Selected)  don`t set to UIInput. Why?
  1.  void Update()
  2.         {
  3.             if (Input.GetKeyUp(KeyCode.Return))
  4.             {
  5.                 mInput.selected = true;
  6.             }
  7.         }
Why it is dont work after click on different widgets?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput.selected
« Reply #1 on: June 11, 2013, 01:13:16 PM »
You are not checking UICamera.inputHasFocus here, so this code will be triggered even when you are typing -- which is wrong.

Look at how the Chat Example is set up.