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 - Christof

Pages: [1]
1
NGUI 3 Support / 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()






2
Thanks, this was a good advise.

My hierachy was:

UIRoot
Camera
Anchor
Panel
...

if I delete the Anchor, everything seems to work.

Are there any problems, when I place my controls in the hierachy below the camera?  (I don't want to change all of my existing scenes). I saw, that in a new empty scene, you place the camera beside the controls.

3
Hi,

I have an issue with the layout of ngui controls in my scenes:

when I run the scene in the editor (especially in full screen mode) and go back to the edit mode then the control layout has changed.

I appended three images to explain what I mean:

1. the correct layout
2. the layout after stopping the execution
3. the layout after running it again, without fullscreen mode

the third image is better but still different from the correct layout.

Somtimes it helps to select the camera, to restore the correct result (but not in this case).

But most times I have to reload the scene and my own changes are lost, if I forgot to save the scene before I run it.

I recently updated from 3.6.1 to version 3.6.6.


Best regards
Christof

4
Inspired by an entry in another forum I successfully tried a different approach. All my own scripts are developed with visual studio using a couple of projects. So only the tools like NGUI reside as loose scripts in unity.

Unity compiles these scripts into the Assembly-CSharp-dll which you can find in the
<root>\Temp\StagingArea\assets\bin\Data\Managed directory.

In my VS projects I reference this Assenbly-CSharp dll and so I have access to all NGUI classes.

Until now this works fine.

Regards
Christof

Pages: [1]