Jump to content
Spikeh

[IN_PROGRESS] NullReferenceException when creating a new group

Recommended Posts

I'm getting the following when I select multiple objects (they are unity prefabs, if that makes any difference - I haven't tried without) and click the "+" button in ProGroups:
 
NullReferenceException: Object reference not set to an instance of an object
ProGroups_Window.NewGroupFromSelection () (at Assets/ProCore/ProGroups/Scripts/Editor/ProGroups_Window.js:20)
ProGroups_Window.OnGUI () (at Assets/ProCore/ProGroups/Scripts/Editor/ProGroups_Window.js:117)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
 
Also, I get the following when I remove a group:
 
NullReferenceException: Object reference not set to an instance of an object
ProGroups_Window.OnGUI () (at Assets/ProCore/ProGroups/Scripts/Editor/ProGroups_Window.js:179)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
 
The groups seem to get created perfectly fine, though...
 
ProGroups version is v1.02
 
Quick video:
 
 

 

Share this post


Link to post
Share on other sites

I can confirm the NREs posted by Spikeh.

Everything seems to stem from the reference to the ProGroups window falling Null at some point.  At first I didn't have any issues so I closed the project and opened it back up and the NREs started to present themselves.  I'm not a UnityScript type of guy, so this totally put me out of my element.  However, here is a quick fix that I did.  I'll dig through the script further and see if there is anything else that looks to be of interest.

 

In the OnEnable() function of the script add this at the beginning of the function:

if(!window)
   window = this;

That will kill all the null references by making sure there is actually a window assigned to the variable every time the ProGroups window get enabled or takes focus.  You can copy and paste that into the code and see if it fixes it for you as well.

 

I'm going to keep digging to see if there is anything else that could be causing the issue and I will send anything I find to Gabriel if it involves enough code that I wouldn't be able to post a snippet here.

Share this post


Link to post
Share on other sites

Thanks for the report Spikeh, and for the confirmation, TrickyHandz- sounds like another case of my shoddy JS code causing trouble. Luckily, ProGroups is up for a C# rewrite ASAP!

Share this post


Link to post
Share on other sites

C# > UnityScript :)

 

In fact, I'd go as far as to say C# > *

 

;)

 

I've installed it without the source code - as much as I'd like to get involved, I have a torrent of my own code to write, so I'm having to be disciplined and leaving other people's code to themselves ;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×