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

Pages: 1 [2] 3 4 ... 11
NGUI 3 Support / NullReferenceException from NGUITransformInspector?
« 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)

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"

Sorry if I'm asking a lot. But there's very little information about the subject and I'm trying to get the hang of editor scripting.

Yes but in your editor scripts, sometimes you use target and manually register undo, sometimes just SPs and other times both! - Why don't you always use SPs and not manually register for undo, etc if they handle everything for you?

Thank you!

If you don't mind please:

1- Generally speaking, are you saying that there's no way to convert a serializedProperty back to a List<SomeClass>? if there is, how? - Problem with using objectReferenceValue is that it's a UnityEngine.Object, and List is a System.Object. Do I have to wrap my list with a MonoBehaviour or something?
2- In this instance you suggested to use target, when do I know that it's safe to use target, and when should I always and must use SPs? because you're using a combination of both in your scripts :/

Thanks a lot!

Sorry I still don't get what you mean:

  1. NGUIEditorTools.DrawEvents("On Use", serializedObject, "onUse");

I just updated to the latest NGUI and still, there are only 2 DrawEvents:

  1. static public void DrawEvents (string text, Object undoObject, List<EventDelegate> list)
  2. static public void DrawEvents (string text, Object undoObject, List<EventDelegate> list, string noTarget, string notValid)

None of which takes a serializedObject as a 2nd parameter, and a string as third.

you passed "onUse" as a string? is that a new overload for DrawEvents?


I have a "MonoBehaviour" with a "List<EventDelegate>" called "onUse" - In my custom editor, I just want to get a 'valid' reference to "onUse" via serialized properties, and then cast the property back to a List<EventDelegate> so that I could draw it - But I'm failing though.

I'm getting the property successfully:
  1. sp_onUse = serializedObject.FindProperty("onUse");

But I don't know what to do here:
  1. NGUIEditorTools.DrawEvents("On Use", use, ???);

On the side: I see in your editor scripts, sometimes you use SerializedProperties and other times you manually register for undo and use target instead. I can see two reasons why you would use target: 1- you wrote the editors before SerailizedProperties came about 2- (same reason I don't use SPs) SPs are very annoying, unpredictable and really tough to work with, debug, etc.

What approach you suggest I go forward with? stick with target and manually register undo, multiple edit, etc? or Wrestle with SPs?

Thanks a lot in advance.

Speaking of suggestions to make things better: I suggest to use a combination of both the ease of use of the old one, and the efficiency and power of the new one.

As a consumer here's how I'd love to see it happen:
I click on Anchor type | from that I get | TopLeft, TopRight, Center, Bottom, etc (Enum values) | click on one, and the widget would automatically anchor to that point (of course there would be a target field that gets automatically filled with the parent object like the new system does it) - after I anchor, there are 2 offset values I could change (much like the relative offset in the old one) - and I can also move the anchored widgets even if it's anchored much like in the new system.

I think that is much simpler as it avoids dealing with those cumbersome 4 values.

That is my humble opinion for "making the new system better" :)

The new anchoring system overcomes the weaknesses in the old system and it does a better job than the previous Anchor+Stretch.

But it's really annoying in terms of practical usage - I mean, I just wanna anchor something to the top left corner of a background, it's just so tedious... What should I do with those 4 values? Previously, I just set the anchor to topleft and that's it. Now we have 4 values... what for? (I've seen the anchor demo video - but it just didn't cut it... )

Please explain what those four values mean - (what does it mean for the right of my object, to be in the right/center/left, etc of the target?)

I just have a very simple Colored slider that I want to anchor to the topleft of a background yet no matter how much I mess with the values, I can't seem to get the right ones....

Please explain.


OK - I found a good solution to my problem - It's OK to anchor the ScrollView (ClippedPanel) - But let the anchor only execute once. So that during the editing time we get full modularity - and then the anchor runs once when the game runs, does its thing, and deactivates - now scrolling works nice, no problems :)

If I don't anchor it, it wouldn't be modular anymore - which is the whole point here... How am I supposed to make it modular, without the anchoring?

I was so excited to check out the new clipping. Well it's here - Although clipping is now easier - much like a widget. But the issues remain the same - Scrolling is still messed up (unless I remove the UIAnchor) - And even more weird stuff is there as well! (Notice how in the beginning of the video, the panel was moving by itself! - I wanted to catch that on video, but managed to only get the end of it, it's .... alive! lol)- Though resizing still works well, much the same. I can't see how this clipped panel is any better than the old, besides the ease to change the clipped panel size like a widget.

Please watch this video:

You could easily reproduce what I have.

Hoping to see those issues resolved in the very near future, for GOOD.


Guess not.

line 402 says: Texture tex = material.mainTexture;
line 250: if (mSprites.Count == 0) Upgrade();

Alright I uploaded a shot of the error - check it out!

Pages: 1 [2] 3 4 ... 11