Author Topic: Exception in UiPopupList (NguiText.Update())  (Read 4694 times)

Christof

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Exception in UiPopupList (NguiText.Update())
« on: September 09, 2015, 09:20:11 AM »
Hey,

i get an exception when I select an entry in the UiPopup (see the stacktrace).
The list is filled by the application, not inside the editor.

This happens only on android and not in the editor.
I'm working with dynamic fonts.

I use the newest ngui-Version (3.9.2) and unity 5.2. This happened also with the previous unity version 5.1.03.

In Unity 4 and the first unity 5 version together with an older ngui version (I don't know which it was) this does not happen.

The exception happens only the first time I open the UiPopupList after the start of the application.


I looked inside the code. This is quite strange. In the beginning of the method NguiText.Update() you test         

  1. if (dynamicFont != null && request)
  2.  

But a few lines later in

  1. if(!dynamicFont.GetCharacterInfo(')', out mTempChar, finalSize, fontStyle) || mTempChar.maxY == 0f)
  2.  

dynamicfont is null, so an exception is thrown.

When I look at the code I can't see, how the value could change to null.


Multithreaded Rendering is not activated.

Any idea?

I attached images of the hierachy in the editor, the settings and a screenshot of the open UiPopupList



NullReferenceException: Object reference not set to an instance of an object

Stacktrace:
NGUIText.Update (Boolean request)
Rethrow as Exception: Abschnitt4: Dynamic Font == null: 'True', ThreadId = 1
NGUIText.Update (Boolean request)
NGUIText.Update ()
UILabel.UpdateNGUIText ()
UILabel.OnFill (.BetterList`1 verts, .BetterList`1 uvs, .BetterList`1 cols)
UIWidget.UpdateGeometry (Int32 frame)
UIPanel.UpdateWidgets ()
UIPanel.UpdateSelf ()
UIPanel.LateUpdate ()
UIPanel.Refresh ()
UILabel.OnFontChanged (UnityEngine.Font font)
UnityEngine.Font.InvokeTextureRebuilt_Internal (UnityEngine.Font font)
UnityEngine.Font:RequestCharactersInTexture(String, Int32, FontStyle)
NGUIText:Prepare(String)
NGUIText:WrapText(String, String&, Boolean, Boolean, Boolean)
UILabel:ProcessText(Boolean, Boolean)
UILabel:ProcessText()
UILabel:ProcessAndRequest()
UILabel:set_text(String)
UILabel:SetCurrentSelection()
EventDelegate:Execute()
EventDelegate:Execute(List`1)
UIPopupList:TriggerCallbacks()
UIPopupList:set_value(String)
UIPopupList:OnItemPress(GameObject, Boolean)
UIEventListener:OnPress(Boolean)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UICamera:Notify(GameObject, String, Object)
UICamera:ProcessPress(Boolean, Single, Single)
UICamera:ProcessTouch(Boolean, Boolean)
UICamera:ProcessTouches()
UICamera:Update()






ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Exception in UiPopupList (NguiText.Update())
« Reply #1 on: September 13, 2015, 05:08:24 AM »
Well, you already ruled out the multi-threaded rendering, so I am not sure what it can be. Dynamic font support has always been one of Unity's downsides though, so something not working quite right is not surprising. Keep in mind that Unity also changed how dynamic fonts work recently. Unity 4's approach differs from Unity 5's.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

YuliyF

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 1
  • Posts: 11
    • View Profile
Re: Exception in UiPopupList (NguiText.Update())
« Reply #3 on: September 14, 2015, 04:30:53 AM »
UiPopupList doesn't use dynamic fonts, checking