Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: vexe on February 13, 2014, 03:06:33 AM

Title: NullReferenceException from NGUITransformInspector?
Post by: vexe on February 13, 2014, 03:06:33 AM
Been getting this error quite a lot recently even with the latest NGUI so I thought you should know about it.

  1. NullReferenceException: (null)
  2. UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/SerializedPropertyBindings.cs:69)
  3. UnityEditor.Editor.GetSerializedObjectInternal () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/EditorBindings.cs:117)
  4. UnityEditor.Editor.get_serializedObject () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/EditorBindings.cs:110)
  5. NGUITransformInspector.OnEnable () (at Assets/External/NGUI/Scripts/Editor/NGUITransformInspector.cs:168)
  6.  

It happens during editor-time - My console gets blown with +999 errors.

There's also the same error for GameObjectInspector too - "Inspector/GameObjectInspector.cs:91"
Title: Re: NullReferenceException from NGUITransformInspector?
Post by: ArenMook on February 13, 2014, 03:18:23 AM
That points to 'serializedObject' being null, which shouldn't be possible. I suggest reporting it as a bug in Unity. I'm guessing you're on the latest 4.6 beta version? I've never seen it in the release.
Title: Re: NullReferenceException from NGUITransformInspector?
Post by: vexe on February 13, 2014, 03:23:17 AM
No I'm using 4.3.3f1
Title: Re: NullReferenceException from NGUITransformInspector?
Post by: ArenMook on February 13, 2014, 03:32:19 AM
4.3.4 here. I think I went from 4.3.2 straight to 4.3.4.
Title: Re: NullReferenceException from NGUITransformInspector?
Post by: vexe on February 13, 2014, 03:33:36 AM
I keep an eye close to the release notes. I didn't see anything worth updating to 4.3.4 so I just didn't do it. I'll update and let you know if I still get the error.
Title: Re: NullReferenceException from NGUITransformInspector?
Post by: NaxIonz on June 10, 2016, 03:39:53 PM
Started getting this quite often once we updated to Unity 5 (never got it on 4.x.y)

Currently on 5.4.3p4
Title: Re: NullReferenceException from NGUITransformInspector?
Post by: Ony on July 07, 2016, 02:55:05 PM
Yup, getting this now using v. 5.3.5
Title: Re: NullReferenceException from NGUITransformInspector?
Post by: ArenMook on July 11, 2016, 01:13:44 AM
Apparently Unity broke something on their end in the editor. You can just add a try/catch block to get rid of that error. NGUITransformInspector.OnEnable:
  1.         void OnEnable ()
  2.         {
  3.                 instance = this;
  4.  
  5.                 if (this)
  6.                 {
  7.                         try
  8.                         {
  9.                                 var so = serializedObject;
  10.                                 mPos = so.FindProperty("m_LocalPosition");
  11.                                 mRot = so.FindProperty("m_LocalRotation");
  12.                                 mScale = so.FindProperty("m_LocalScale");
  13.                         }
  14.                         catch {}
  15.                 }
  16.         }