[BUG?] State Inspector Helper script GameObjects created in hierarchy present in edit mode

DankP3

Active member
Apologies for the lack of specifics as this is an old report i posted in discord, but i noticed another user in discord with the same observation:

Apologies for the appalling lack of detail in this post, but i am hoping you can provide pointers as to what may be wrong/what is doing this?
A second user in discord recently reported this so we may get more specific version information from them.

1. Character controller variant (Ultimate Character Controller, First Person Controller, etc).
UCC (sorry this is an old report from 31st October 2019, likely the latest asset store version at that time)
EDIT: Reported in discord by another user as occurring on UCC version2.1.9

2. Unity version (include which SRP, beta Unity versions aren't supported)
Most likely a flavour of 2018.3 - not beta (again apologies)
EDIT: Reported in discord by another user as occurring on Unity 2019.1.14f1

3. Bug description
new game objects are created in the hierarchy with a State Inspector Helper script. These are observed in edit mode. Can occur in multiples - see pictures.
GOs.png
Inspector.png

4. Steps to reproduce
No idea, i thought initially linked to a Unity crash, but has occurred again since without a unity crash.
Frequency is rare.

5. The full error message (if any)
N/A, see pictures.
 
Last edited:
The State Inspector Helper component is used to serialize the state data on the GameObjects. This component should automatically be added and removed within the same frame when there is a change so you shouldn't ever see it. Definitely let me know if you (or anybody else) is able to consistently reproduce this component showing up and I'll get it fixed.
 
I encountered this too. I don't know how I got into this state, but I was able to fix it while investigating the system. I think the reorderable list got corrupted at some point and was using bad values in the Item Set Manager, Items List.

I think a combination of things fixed it for me, but I think what actually worked was forcing the serialization to refresh the reordable list values. It's sorta a mystery as to exactly what fixed it, but here is what I did...

1. In the Item Set Manager, I switched the Item Collection back to the DemoItemCollection. It still created lots of game objects.

2. I deleted the items in the item collection one by one until no items remained and it started raising IndexOutOfRange Exceptions.

3. I switched back to my item collection, it still created lots of game objects and raised that strange exception on line 112.

Attaching a debugger gave me an exception in ItemSetManagerBaseInspector.cs at the end of the OnInsepctorGUI function on line 112 (Object not instantiated, I think), it didn't make much sense, so I added more breakpoints.​

4. I deleted all the items in my list, and then I got the IndexOutOfRange Exception there too.

5. I re-added 1 item and the game objects started getting created again, so I again, removed the item from the item collection to get back to that IndexOutOfRange Exception.

In the debugger, I found that in the ItemSetManagerBaseInspector.cs, the ItemSetReorderableList.Index was returning -2, an invalid value, and this raised an exception on line 101 because the ItemSetReorderableList.Index is expected to be a valid array index of ItemSetList, but it wasn't in my case.


6. To fix this, on line 99 in the ItemSetManagerBaseInspector.cs file, I added a check to ensure the ItemSetList actually contains values.

for example:
if (m_ItemSetManager.CategoryItemSets.ItemSetList.Count > 0 && m_ItemSetReorderableList.index > -1 && m_ItemSetReorderableList.index < m_ItemSetManager.CategoryItemSets.ItemSetList.Count) {

This fixed the IndexOutOfRange Exception if an ItemSetList is empty.

7. So, I added one object to my Item Collection, and the game objects were not created in my scene (at least, I didn't notice them being created and destroyed anymore).

After all that, things started working again. I tried my best to break it again by reverting the code changes and messing with setting/unsetting fields in the Item Set Manager, but I can't get it to reproduce. I just reverted the file and am keeping that way.

So, I think the reorderable list got corrupted, somehow, at some point and was using bad values.
 
Are you using the latest version? I added a try/catch block to the state reorderable list which should clean up after itself if there is any sort of error.
 
It was with:
* Unity 2021.1.12f1 to 2021.1.15f1 (I probably started with an earlier version of Unity, but I try to update them when they come out)
* Third Person Controller version 2.3.4
* Agility Pack 1.1.1
* Climbing Pack 1.0.1
* The last version of the Ultimate Inventory System (and integration package)

I actually upgraded the projects last night to (after getting the issue fixed):
* Unity 2021.1.16f1
* Third Person Controller version 2.3.5
* Ultimate Inventory System 1.1.8 (and latest integration package)

Thanks,
 
Top