Author Topic: Null ref exception in UI panel when using NGUI Texture  (Read 3917 times)

CarlosMassiah

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 10
    • View Profile
Null ref exception in UI panel when using NGUI Texture
« on: October 29, 2014, 06:15:41 AM »
I'm currently getting a null ref exception in UI panel when I use NGUI textures on a an item.
I'm instantiating a bunch of objects that contain a couple of labels and sprites + the ngui textures. They are being instantiated in a UIGrid.
The editor spams the below command stack a few times and then does not render my objects.
I don't know what I'm doing to kill NGUI in this circumstance as I have used the same prefabs in other UI's

  1. NullReferenceException
  2. UnityEngine.Material..ctor (UnityEngine.Shader shader) (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/ShaderBindings.cs:149)
  3. ...
  4. UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1170)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Null ref exception in UI panel when using NGUI Texture
« Reply #1 on: October 29, 2014, 06:16:43 AM »
UIPanel's line 1170 for me is a bracket. What version are you on? Please update to the latest.

CarlosMassiah

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: Null ref exception in UI panel when using NGUI Texture
« Reply #2 on: October 31, 2014, 09:34:45 AM »
On latest now. New line no's below. I can also get this to happen when selecting shaders in the editor. I can do this in a new scene with only a texture in it and selecting shader: Particles/Blended

  1. NullReferenceException
  2. UnityEngine.Material..ctor (UnityEngine.Shader shader) (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/ShaderBindings.cs:149)
  3. UIDrawCall.CreateMaterial () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:329)
  4. ...
  5. UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1181)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Null ref exception in UI panel when using NGUI Texture
« Reply #3 on: November 01, 2014, 05:17:50 AM »
Are you trying to use that shader on something inside a scroll view? Because the Particles/Blended doesn't have a clipped version. It can't be used. It needs to be an NGUI shader for something to be clipped.

CarlosMassiah

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: Null ref exception in UI panel when using NGUI Texture
« Reply #4 on: November 03, 2014, 06:05:58 AM »
I'm not using that shader. That was just the quickest thing I came up to repro outside of my main project.

How can I tell which shaders have a culling version and which don't?
As a work around I have switched off culling in UIPanel. Thanks for the info.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Null ref exception in UI panel when using NGUI Texture
« Reply #5 on: November 03, 2014, 06:56:46 AM »
If it's an NGUI shader, it will work. If it's not, it won't.