Author Topic: I have a problem with activating widgets  (Read 7631 times)

KJLee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 5
    • View Profile
I have a problem with activating widgets
« on: March 21, 2017, 10:20:43 PM »
Hi, I'm a game developer using Unity3d and NGUI.

I recently updated NGUI to 3.11.2, and got two problems.

First problem is that the game screen shows a weird widget which shows the whole atlas image in a very short time.
It shows when a widget is activated.

Here is the screen shot.



and the video here.

https://youtu.be/MMN7lPuFzu0

I don't even guess if this is NGUI bug, or Unity3d bug.

The other problem is the UILabel is rendered at wrong position.



As you can see above, the widget's position is correct, but the actual number is drawn at wrong position.
This happens after I update NGUI to 3.11.2.

If you had any problems like these, please let me know how to fix it. It makes me crazy.

Thank you all.


bitwise

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 6
    • View Profile
Re: I have a problem with activating widgets
« Reply #1 on: March 22, 2017, 12:50:33 AM »
I can't see your screenshots. but I have similar UILabel problem.
Sometimes text is placed at random position and with random styles.

Recently, I've updated Unity3D (5.4.x -> 5.5.2) and NGUI 3.11.2 at the same time.  :-[
I didn't check whether the problem is caused by Unity or NGUI yet.


KJLee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 5
    • View Profile
Re: I have a problem with activating widgets
« Reply #3 on: March 22, 2017, 01:18:43 AM »
I can't see your screenshots. but I have similar UILabel problem.
Sometimes text is placed at random position and with random styles.

Recently, I've updated Unity3D (5.4.x -> 5.5.2) and NGUI 3.11.2 at the same time.  :-[
I didn't check whether the problem is caused by Unity or NGUI yet.

Thank you for your reply.

I put update() method in UILabel.cs script which calls MarkAsChanged() every frame, and it works.

bitwise

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 6
    • View Profile
Re: I have a problem with activating widgets
« Reply #4 on: March 22, 2017, 09:51:34 PM »
I reverted UILabel.OnFontChanged().
It seems to work.

KJLee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 5
    • View Profile
Re: I have a problem with activating widgets
« Reply #5 on: March 23, 2017, 08:58:02 PM »
I reverted UILabel.OnFontChanged().
It seems to work.

Thank you so~ much!!
I reverted the method to 3.8 version and it seems to work now.
Really appreciate~

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: I have a problem with activating widgets
« Reply #6 on: March 26, 2017, 07:45:10 AM »
Did it get broken yet again? That method was changed about 2 months ago to fix something in 5.5.X. Which version of it works this time around? Can you paste the code that's working?

KJLee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 5
    • View Profile
Re: I have a problem with activating widgets
« Reply #7 on: March 27, 2017, 12:36:54 AM »
Did it get broken yet again? That method was changed about 2 months ago to fix something in 5.5.X. Which version of it works this time around? Can you paste the code that's working?

Sure.
The following is the code I pasted.

  1. static void OnFontChanged (Font font)
  2.         {
  3.                 for (int i = 0; i < mList.size; ++i)
  4.                 {
  5.                         UILabel lbl = mList[i];
  6.  
  7.                         if (lbl != null)
  8.                         {
  9.                                 Font fnt = lbl.trueTypeFont;
  10.  
  11.                                 if (fnt == font)
  12.                                 {
  13.                                         fnt.RequestCharactersInTexture(lbl.mText, lbl.mFinalFontSize, lbl.mFontStyle);
  14.                                         lbl.MarkAsChanged();
  15.  
  16.                                         if (lbl.panel == null)
  17.                                                 lbl.CreatePanel();
  18.  
  19.                                         if (mTempDrawcalls == null)
  20.                                                 mTempDrawcalls = new BetterList<UIDrawCall>();
  21.  
  22.                                         if (lbl.drawCall != null && !mTempDrawcalls.Contains(lbl.drawCall))
  23.                                                 mTempDrawcalls.Add(lbl.drawCall);
  24.                                 }
  25.                         }
  26.                 }
  27.  
  28.                 if (mTempDrawcalls != null)
  29.                 {
  30.                         for (int i = 0, imax = mTempDrawcalls.size; i < imax; ++i)
  31.                         {
  32.                                 UIDrawCall dc = mTempDrawcalls[i];
  33.                                 if (dc.panel != null) dc.panel.FillDrawCall(dc);
  34.                         }
  35.                         mTempDrawcalls.Clear();
  36.                 }
  37.         }

I copied this code from version 3.9.4, and it doesn't have any problems yet.

mdeletrain

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 71
    • View Profile
Re: I have a problem with activating widgets
« Reply #8 on: April 03, 2017, 04:34:35 AM »
Does anyone have a simple repro case so I can look at it ?

zhangchen915

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: I have a problem with activating widgets
« Reply #9 on: October 03, 2017, 03:59:22 AM »
I user the mothod from version 3.9.4 and decrease the incidence of the bug, but it still exist in one frame and after that
frame the bug disappear especially slow mobile. Is there any other way to deal with this bug