Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - titan_artix

Pages: [1]
1
NGUI 3 Support / Re: UICamera.currentScheme changes to Mouse unexpectedly
« on: October 10, 2017, 02:20:29 PM »
Hey thanks for the response,

We're specifically trying to support devices like the Surface tablet where the user might be playing with Touch and then decide to dock the tablet at their desk with a keyboard and mouse and continue playing.  Our game logic supports this setup and things worked for us in the previous version of NGUI.  For a long while now we've checked 'Mouse', 'Touch' and 'Keyboard' as our Event sources (shown in screenshot)

Since we updated to 3.11.4, this behavior no longer works. Now even while exclusively using touch only on a tablet like a Nexus 7, the system switches over to Mouse on alternative touches. Any help here would be great.

2
NGUI 3 Support / Re: UICamera.currentScheme changes to Mouse unexpectedly
« on: October 04, 2017, 08:58:50 AM »
After messing around with this for a while more, I found that changing the line of code below seems to prevent the unintended scheme switch from Touch to Mouse and things work on both Touch devices and Keyboard / Mouse setups as expected.  I'm not sure what other consequences changing this line has yet as we haven't tested it extensively, but so far this tweak seems to prevent Touch inputs from being interpreted as Mouse input:

In UICamera.cs, I changed this around line 2130:
  1. if (currentScheme == ControlScheme.Touch && activeTouches.Count > 0) return;

To this:
  1. if (currentScheme == ControlScheme.Touch) return;

We definitely need more testing to determine why this works and I doubt tweaking this line is a good thing as there are probably other unintended consequences.  Any ideas why this change would fix things? I haven't been able to pinpoint what's going on, even after performing a full file diff between versions.

3
NGUI 3 Support / UICamera.currentScheme changes to Mouse unexpectedly
« on: September 29, 2017, 02:34:42 PM »
We recently upgraded our project from 3.10.2 to 3.11.4.

Our game runs on Android and iOS handheld devices as well as on PC and Mac via Steam.

After completing the NGUI upgrade process and releasing our game update, we received several report that our mobile interface on Android and iOS would convert incorrectly and show our PC interface. We have logic in place that detects user input and displays the appropriate interface accordingly.  In fact we have even supported devices like a Surface tablet where the user could be using touch, then attach a keyboard and mouse and successfully continue playing with the correct PC interface.

Suddenly now after the 3.11.4 update, we're seeing our intended behavior is not working correctly.  After some testing, we've detected that the UICamera.currentScheme property returns Mouse incorrectly when exclusively using Touch only.  We tested this on a Nexus 7 and Google Pixel and both would find that the currentScheme would switch to Mouse on every alternate touch. This could then lead to an unintended UI change on our end when our logic looks to currentScheme to determine the layout.

You could see how a check like this would fail if the currentScheme value was no longer Touch.
  1. if (UICamera.currentScheme == UICamera.ControlScheme.Touch)
  2.      ControlScheme = ControlScheme.HANDHELD;
  3. else
  4.      ControlScheme = ControlScheme.PC;
  5.  

I tracked this down further and found that the switch to Mouse seems to originate in the ProcessMouse() function of the UICamera class around line 2157, when the sqrMag value check doesn't return. Instead logic proceeds and the currentKey is set to KeyCode.Mouse0.  This seems to then convert the Scheme to Mouse shortly afterward and everything gets messed up.

In NGUI's previous version this switch to Mouse doesn't occur.  We tried to diff the code to figure out what's up, but haven't quite been able to pinpoint the issue.  Any help here would be great.

We haven't made any other changes that would affect this logic and we've been using all of the Event Sources below successfully for a long while now.


4
Thanks for the response. In our project, the OnFinished callback is often used within the Unity Editor to define permanent methods that handle the completion of Tweens (color, alpha, etc). An example of this use case is shown in the attached image where we perform some simple actions after our cast bar animation completes. Our intention is for this callback to remain permanently as the cast bar animation can be played and completed multiple times during a user session. 

In code, we generally call something like this to start the animation:
  1. TweenColor.Begin(bg.gameObject, 0.3f, InterfaceColors.CastBar.Interrupt);

We then rely on the permanent editor defined callback to complete our logic loop. Now with the 3.11.1 update, since the OnFinished list is cleared when calling Begin(), the callback logic never fires.

Sorry if I'm missing something basic here (I recently joined this team and I'm a bit of an NGUI novice; my previous project used Unity's native GUI). Any help here would be useful.

5
Apologies for the typos in my first post. It seems there is no edit post functionality. 

I just wanted to add clarity to the issue. In our previous build, we used NGUI (v3.10.2) and had no issues. Since upgrading to NGUI v3.11.1, we noticed that the callbacks for several Tween-based events simply are not firing in our game. Anything previously reliant upon the UITweener OnFinished callback no longer fires because the OnFinished list is cleared immediately within Begin(). 

We can easily fix the issue by commenting out the lines that call Clear(), but we don't understand why that was added?  It seems your intention was to clear any one-time only callback events, but since our intention is to use these as permanent callbacks that should fire everytime a tween completes things are breaking.

Can you shed some light on what we're doing wrong?

6
Hey guys,

Just updated to 3.11.1 yesterday and released this morning that the NGUI update is causing some issues related to callbacks in our project.  We first noticed the problem when a callback event wasn't firing properly.  After diagnosing for a bit, we released that UITweener Begin() now clears the OnFinished delegate list on line 486:

  1. comp.onFinished.Clear();

This line isn't make much sense to us as it instantly breaks all of our callbacks where we've defined the OnFinished callback in the Unity Editor.  An example is with the TweenColor component as shown in the pictures below.  Everything looks fine in the editor, but at run time the reference is cleared just before usage. Commenting out line 486 fixes everything for us, but we don't love that option and want to better understand the intention here.


Pages: [1]