#ArgumentException: We are reading a UnityEngine.Object but the deserialized index is out of range...

1 messages · Page 1 of 1 (latest)

sage garnet
#

Entities 1.2.0
Unity Editor 2022.3.23

I'm getting two similar errors apparently when trying to load a scene. Everything worked fine before updating to 1.2.0.

I'm not really sure whether this is a baking or a content management issue, so I'm tagging both for now.

Errors below.

obtuse mulch
#

Anything noteworthy in the scene itself?

sage garnet
#

That's what I'm trying to determine right now. I don't think there's anything special.
The scene has a EntityPrefabReference to 2 big prefabs which are the managers for Client and Server worlds.

#

Those prefabs may have a few Managed Components, like this. Actually that might be the only one, but I'm not completely sure.

obtuse mulch
#

Just to run down the list, you've tried clearing the entity cache?

sage garnet
#

Yes

#

I tried removing that component from baking, but the issue persist. I'll try to see if there's another managed component.

sage garnet
#

I'm getting this warning right before the errors shown above. I checked the prefabs I mentioned, and there's no sight of any missing component or reference. What else could cause this warning?

obtuse mulch
#

I don't know. Any chance you can write up a bug or put a project up somewhere?

sage garnet
#

I can write the bug report, but for the repro project I'd need to pin down the issue. My project is too big to share.

obtuse mulch
#

Gotcha

tame eagle
sage garnet
south geode
#

Can you try convert your unity object references to UnityObjectRef<>

#

(pools parent is what I'm looking at)

#

Most failures I've seen like this were from Object references that also end up in seperate asset bundles such as Resources (or addressables) and that just seems to break.

#

That said, UnsafeHashSet?

#

Are you trying to serialize that during baking?
You can't bake allocated containers

sage garnet
sage garnet
# south geode That said, UnsafeHashSet?

That component was a result of things not working like they were supposed to in previous versions. The collection was actually empty at baking time, I just needed the component present in that prefab. But I just removed it, I add it at runtime now.

sage garnet
# obtuse mulch Gotcha

I haven't found out the real issue yet, but I found this.

After removing a buch of stuff (Components and references to prefabs), I'm left with a prefab that I use to spawn some particles using VFX Graph. The thing is, as soon as I remove all VFX Graph components in the prefab and children, the issue is gone.

Also, if I just delete the reference to this prefab, the issue is gone too.

obtuse mulch
#

Do you get this in the editor when loading a scene, or just a player build?

sage garnet
#

Editor.

#

Also, the workflow in my project is like

Scene-> Loads Subscene-> Loads Server & Client Manager Prefabs -> Those have a reference to all the rest of the prefabs (including the particle mentioned above).

obtuse mulch
#

Ah okay

sage garnet
#

Does the UnityObjectRef<T> inspector is supposed to work now? I'm trying to drag and drop the object and clicking the circle thing on the right but none of those work. _CoreMixer is the UnityObjectRef<AudioMixer> version of CoreMixer.

This complicates things a little more

south geode
#

can't use UnityObjectRef as a field on your authoring

#

it will break during baking as it only serializes instanceid

#

which will be different in your baker thread

#

it has an implicit conversion to T

sage garnet
#

Oh ok ok. My bad

south geode
#

actually i think this is unitys bad by marking it serializable and giving it a custom inspector

#

that makes it appear like it works

sage garnet
#

Hahaha my bad for not guessing correctly this Unity puzzle

#

So, in one of the cases causing the issue, replacing a managed component that has a direct reference to a Unity.AudioMixer, with an unmanaged component that uses UnityObjectRef<AudioMixer>, changes the error message to these two shown here.

Not adding the component at all, removes the issue.

south geode
#

where does the AudioMixer exist?

#

is it a prefab? in the subscene? in the regular scene?

sage garnet
#

It's an asset in a generic folder. And it's not being used by Addressables, the only place it's being referenced is the Authoring Component used to bake the components mentioned above.

south geode
#

hmm that avoids basically every issue i know of

sage garnet
#

Oh haha, that's not good. And from what I've seen, the issue can be anywhere where managed components or Unity.Objects are used.

sage garnet
#

@obtuse mulch I replicated the SoundsManager authoring workflow in a new project, and I haven't been able to reproduce the issue. So even though, the managed object is triggering the errors, it's not the main reason. Something else is messing with the project, and now I have no idea where to look at. What should I do? If I create a bug report with this info they'll probably just ignore it.

obtuse mulch
#

Ignore? No. But without repro info yeah it’s tough to solve. I’ll take a look next week and see if there’s any traces that might be helpful