Support => NGUI 3 Support => Topic started by: PaulGregory on November 29, 2013, 05:34:00 AM
Title: Changing UISprite atlas makes inspector blank, errors
Post by: PaulGregory on November 29, 2013, 05:34:00 AM
I'm using 3.0.6f6, and switching the UISlicedSprite on a load of buttons that were created with the SciFi Atlas to use my own imagery from my own Atlas.
I can change about 4 or 5 at a time before things start going wrong.
Upon changing the Atlas in the inspector, the inspector changes to be almost blanked out - just a small rectangle at the top left.
This error pops up in the console (4 times every time I return to Unity):
NullReferenceException:Object reference not set to an instance of an object
NGUIEditorTools.DrawSprite(UnityEngine.Texture2D tex, Rect drawRect, .UISpriteData sprite, Color color, UnityEngine.Material mat)(at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:705)
If I select another thing in the Hierarchy I get these errors:
The serializedObject should not be used inside OnSceneGUI or OnPreviewGUI.Use the target property directly instead.
UnityEditor.GameObjectInspector:OnEnable()
The targets array should not be used inside OnSceneGUI or OnPreviewGUI.Use the single target property instead.
UnityEditor.GameObjectInspector:OnEnable()
If I press Play and Stop, everything sorts itself out and I can continue changing the UISprite.
I'm on a Mac, and these are sprites that had been added with earlier versions of NGUI (3.0.x) if that makes any difference.
After a Play and Stop restart I can do 4 or 5 as I say but then the next one starts going mad.
This is rather annoying.
Title: Re: Changing UISprite atlas makes inspector blank, errors
Post by: ArenMook on November 29, 2013, 09:00:47 AM
UISlicedSprite has been removed back in 3.0.0, and has been only left for backwards compatibility in the upgrade package. Did you run the upgrade tool to auto-upgrade all of them to normal sprites set to sliced mode?
Title: Re: Changing UISprite atlas makes inspector blank, errors
Post by: PaulGregory on November 29, 2013, 10:42:41 AM
I did not use NGUI before 3.0.something so I have had no need of the upgrade package. I could do with one from 3.0.5 to 3.0.6 though!
The component *is* a UISprite with the sprite mode set to sliced. The object has the name/label UISlicedSprite, probably from the sample stuff.
Having ploughed through with it (as there is a workaround of play/stop), I can say that sometimes I got the error straight away (ie first sprite, not 4th or 5th).
Title: Re: Changing UISprite atlas makes inspector blank, errors
Post by: ArenMook on November 29, 2013, 10:51:40 AM
Curious. Well, on line 701 of the same file (NGUIEditorTools) there is a check: