#Custom world causes UI exceptions

1 messages · Page 1 of 1 (latest)

ripe anchor
#

Upon switching to my custom world in the entities hierarchy, this error is triggered via the UI. It's a little hard to see what's wrong with the data, since the entities UI is not functioning for this world.

ArgumentException: A component with type:Unity.Scenes.SceneEntityReference has not been added to the entity. Entities Journaling may be able to help determine more information. Please enable Entities Journaling for a more helpful error message.
...
Unity.Entities.EntityManager.GetComponentData[T] (Unity.Entities.Entity entity) (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.65/Unity.Entities/EntityManager.cs:362)
Unity.Entities.Editor.SubSceneMap.IntegrateChanges (Unity.Entities.World world, Unity.Entities.Editor.HierarchyNodeStore nodeStore, Unity.Entities.Editor.HierarchyNameStore nameStore, Unity.Entities.Editor.SubSceneChangeTracker+SubSceneMapChanges changes) (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.65/Unity.Entities.Editor/Hierarchy/Model/SubSceneMap.cs:35)
Unity.Entities.Editor.HierarchyUpdater.MoveNext () (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.65/Unity.Entities.Editor/Hierarchy/Model/HierarchyUpdater.cs:346)
...

I load the subscenes one by one, store their entities, then copy all those entities and their ResolvedSectionEntity references to the simulation world.

This was working well in pre.15, did anyone encounter similar issues?

#

Maybe I've mismanaged something with the SceneTag component..

I vaguely recall there were only two entities storing the scene data (if there was only one subsection), but now I see three (one in the scene, two outside of the scene). I'll dig a bit more on monday.

ripe anchor
#

For some reason, when the editor integrates scene changes, there are three entities in "CreatedSceneTags", but the second one in this list does not exist in the world the scene map is used for. It is the SceneTag.Entity from the default world, which of course doesn't have a SceneEntityReference component in my custom world.

pliant hatch
#

hmm, are you coping all the scene specific components as well?

ripe anchor
#

yes I am; this way they show up in the same scenes in both worlds

#

it was working well in pre.15 anyway

pliant hatch
#

(i'm not really sure why you're opening your subscenes in a separate world and then copying them to another world? why not just open them in the final world?)

ripe anchor
#

the scenes contain data for both rendering and simulation, I'm only copying the simulation parts

pliant hatch
#

at a minimum, i think you'd need to make it point to the subscene entity in the new scene

ripe anchor
#

yes, I did that

#

you can see the SubSceneTag: Entitiy(99:1), it is in the new world

#

there are only 2 scenes so having 3 subscenetags in the changelist is not right

ripe anchor
#

I did not expect that, seems like the query doesn't cover all entities that have the scene tag

#

4 instead of 3, 127:1 still exists somewhere

#
EntityQuery sceneTagQuery = new EntityQueryBuilder(Allocator.Temp)
    .WithAll<SceneTag>()
    .WithOptions(EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabledEntities)
    .Build(simEntities);

🤔 ..

#

looks like there are no entities that use this scene tag, but the shared component still exists in the entitymanager, this must be causing the issue

#

I do not understand why only one of the two entities still exists as shared component though, the other one has been cleaned up normally 🤔

pliant hatch
#

Shared components can exist with no entity

ripe anchor
#

it looks like when a shared component isn't used anymore after a call to SetSharedComponent, it's only cleaned up after a *second call to SetSharedComponent

and since the UI doesn't check if the shared component is actually used ..

#

after the first SetSharedComponent, the one that's unused as a result is still there until i pass to the next one

#

Now I really miss the good old data breakpoints ^_^'