Author Topic: After I upgraded to NGUI 3.11.0b or 3.11.0c, it shows following errors  (Read 6102 times)

sspsos74

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 4
    • View Profile
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Mesh.SetUVs (Int32 channel, System.Collections.Generic.List`1 uvs) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/GraphicsBindings.gen.cs:913)
UIDrawCall.UpdateGeometry (Int32 widgetCount) (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:579)
UIPanel.FillAllDrawCalls () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1395)
UIPanel.UpdateSelf () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1317)
UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1268)

When I used NGUI 3.10.x, it worked perfect.
I didn't do anything but just upgraded and it shows the errors...

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: After I upgraded to NGUI 3.11.0b or 3.11.0c, it shows following errors
« Reply #1 on: December 04, 2016, 09:33:35 AM »
Is this the line in question?
  1. mMesh.SetUVs(1, (uv2 != null && uv2.Count == vertexCount) ? uv2 : null);
All it's doing is setting UV2s, if you chose to have UV2s enabled on the panel. It checks for null before passing the uv2 array, so I'm not sure what the null ref can possibly be here? Everything works as expected on my end in all 3 versions of Unity (4.7, 5.4 and 5.5), so I will need more details on how to reproduce.

jovianminds

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: After I upgraded to NGUI 3.11.0b or 3.11.0c, it shows following errors
« Reply #2 on: December 04, 2016, 07:29:38 PM »
I'm on 5.3.5, and I'm seeing the same exception.  It seems like mesh.SetUVs will throw an exception (at least on this version of Unity) if you pass null.  I pulled the if check out and wrapped it around the call, and now all runs fine.

  1. //OLD LINE: mMesh.SetUVs(1, (uv2 != null && uv2.Count == vertexCount) ? uv2 : null);
  2. if (uv2 != null && uv2.Count == vertexCount)
  3.     mMesh.SetUVs(1, uv2);

I'm just not sure if there needs to be an else clause that passes an empty List<Vector4>.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: After I upgraded to NGUI 3.11.0b or 3.11.0c, it shows following errors
« Reply #3 on: December 04, 2016, 10:21:30 PM »
sspsos74, can you confirm that you're also on pre-Unity 5.4?

sspsos74

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 4
    • View Profile
Re: After I upgraded to NGUI 3.11.0b or 3.11.0c, it shows following errors
« Reply #4 on: December 05, 2016, 04:38:39 AM »
I'm using unity 5.3.7p2 personal...

when I play my project in unity editor, following errors also appears.

Too many vertices on one panel: 65244
UnityEngine.Debug:LogError(Object)
UIDrawCall:UpdateGeometry(Int32) (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:601)
UIPanel:FillDrawCall(UIDrawCall) (at Assets/NGUI/Scripts/UI/UIPanel.cs:1497)
UIPanel:UpdateSelf() (at Assets/NGUI/Scripts/UI/UIPanel.cs:1325)
UIPanel:LateUpdate() (at Assets/NGUI/Scripts/UI/UIPanel.cs:1268)



ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[UnityEditor.TreeViewItem].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
UnityEditor.GameObjectTreeViewDataSource.GetItem (Int32 row) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/GameObjectTreeViewDataSource.cs:131)
UnityEditor.GameObjectTreeViewGUI.DoStickySceneHeaders () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/GameObjectTreeViewGUI.cs:113)
UnityEditor.GameObjectTreeViewGUI.BeginRowGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/GameObjectTreeViewGUI.cs:182)
UnityEditor.TreeView.OnGUI (Rect rect, Int32 keyboardControlID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeView.cs:494)
UnityEditor.SceneHierarchyWindow.DoTreeView (Single searchPathHeight) (at C:/buildslave/unity/build/Editor/Mono/SceneHierarchyWindow.cs:505)
UnityEditor.SceneHierarchyWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneHierarchyWindow.cs:320)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)






new version's UI Panel has a check box : UV2 (for custom shader effects) - I didn't see this in previous version.
if I check it, it seems show NGUI panel in Unity editor mode (when I upgraded NGUI, my NGUI ui's were vanished and it showed errors) but if I reload this scene, it's unchecked (I don't know why ???)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: After I upgraded to NGUI 3.11.0b or 3.11.0c, it shows following errors
« Reply #5 on: December 05, 2016, 04:46:32 AM »
Yep, that would be it then. Officially, NGUI 3.11 supports Unity 4.7, 5.4 and 5.5. I've made the changes locally so you will find them in the next update, but until then you can make the same change locally to get it working as expected. I'm attaching the modified UIDrawCall file for convenience.

sspsos74

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 4
    • View Profile
Re: After I upgraded to NGUI 3.11.0b or 3.11.0c, it shows following errors
« Reply #6 on: December 05, 2016, 05:37:14 AM »
 ;D
Thank you for your support.

Actually, I can wait for next update too.
Also I want to migrate my unity project to version 5.5.x of Unity but several assetstore assets are not migrated to unity 5.5.x yet.
So I have to wait those assets support unity5.5.x

Anyway, Thanks always for your supports.  :D