Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: danfoo on April 24, 2013, 08:33:13 AM

Title: UICamera.touchCount BUG? KeyNotFoundException
Post by: danfoo on April 24, 2013, 08:33:13 AM
Hi,

Calling UICamera.touchCount
  1. if(activeTouches != UICamera.touchCount)
results in an error on line 386 in UICamera.cs:
KeyNotFoundException: The given key was not present in the dictionary.
  1.         if (mTouches[i].pressed != null)

Please advise? Thanks!
//Daniel
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: danfoo on April 24, 2013, 08:36:20 AM
I should probably add that this happens when only using touches in the editor (via Unityremote). After disabling mouse input in UICamera, the error started to occur.
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: Nicki on April 24, 2013, 11:09:59 AM
Unity remote is crap; don't rely on it.
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: danfoo on April 26, 2013, 06:59:37 AM
Unity remote is crap; don't rely on it.
Not really a constructive reply. I see you are a moderator. Does that mean I should consider your reply as one backed by Tasharen?

Unityremote is quite handy during UI testing, at least it was with our previous UI system. How else would you suggest we do fine-tuning? Build the project each time we tweak a value? You can't be serious.
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: ArenMook on April 26, 2013, 12:44:47 PM
Unity remote sends both mouse and touch events from a single action, which messes with NGUI, which is why using it is not advised.

Change this:
  1. for (int i = 0; i < mTouches.Count; ++i)
  2.                                 if (mTouches[i].pressed != null)
  3.                                         ++count;
to this:
  1. foreach (KeyValuePair<int, MouseOrTouch> t in mTouches)
  2.                 if (t.Value.pressed != null)
  3.                     ++count;
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: Zapgun on April 27, 2013, 03:42:39 PM
I was having the same issue running my game under iOS and the XCode debugger, however this patch fixed it for me...were you planning on including it in an upcoming release?

- Zapgun
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: ArenMook on April 27, 2013, 03:43:08 PM
It's already in the Pro version, so yup.
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: Nicki on April 27, 2013, 07:19:46 PM
No, my answers are not official support answers by Tasharen, I'm just helping out in here.

Unity remote is utterly useless in my opinion, but your mileage may vary.
Not really a constructive reply. I see you are a moderator. Does that mean I should consider your reply as one backed by Tasharen?

Unityremote is quite handy during UI testing, at least it was with our previous UI system. How else would you suggest we do fine-tuning? Build the project each time we tweak a value? You can't be serious.
Title: Re: UICamera.touchCount BUG? KeyNotFoundException
Post by: danfoo on April 29, 2013, 10:03:57 AM
It's already in the Pro version, so yup.
Thanks. Perhaps it's time to upgrade to pro...