A verse component that creates a root entity and adds mesh_component children results in invisible meshes

Summary

Before 36.00 I made a script that creates a root entity and it adds child entities with mesh_components to it, this worked well before 36.00 but after the update the meshes are invisible and the collision is buggy

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

The following code steps:

First add this to a OnBegin function in a

entity spawner device (verse script)

if(Entity := GetSimulationEntity):
NewEntity := entity{}
VerseComponent := custom_verse_component{ Entity := Entity }
NewEntity.AddComponents(array{ VerseComponent })
Entity.AddEntities(array{ NewEntity })

Then for the custom_verse_component.verse script

OnBeginSimulation():void =
(super:)OnBeginSimulation()
TestRoot := entity{}
Entity.AddEntities(array{ TestRoot })
NewEntity := Entities.ā€œAny entity with a mesh_component hereā€{}
TestRoot.AddEntities(array{ NewEntity })

Expected Result

The meshes should be visible and collision shouldnt be buggy

Observed Result

After spawning it the mesh wont be visible and the collision will be buggy,
I also noticed printing the TransformComponent.GlobalTransform.Translation causes the game to end with a network error which worked fine before the beta

Platform(s)

PC

We’ll get someone to take a look. Thank you for reporting.

While we investigate, let’s double-check this code chunk here:

VerseComponent := custom_verse_component{ Entity := Entity }
NewEntity.AddComponents(array{ VerseComponent })

It looks like the custom verse component is having it’s entity initialized to the simulation entity, not NewEntity like you might have intended.

Consider changing Entity := Entity to Entity := NewEntity

VerseComponent := custom_verse_component{ Entity := NewEntity}
NewEntity.AddComponents(array{ VerseComponent })

Let us know if that helps. Thank you! :slight_smile:

That was only a typo I made while renaming the variables so they can be understood easier but in the original code I already put the Entity := NewEntity, the issue is still there

I also did some testing with a fresh version of the code to make sure its not caused by something else, but its still the same issue, also it was working fine before 36.00

entity_spawner_device<public> := class(creative_device):
     OnBegin<override>()<suspends>:void=
         if(Entity := GetSimulationEntity[]):
             NewEntity := entity{}
             VerseComponent := custom_verse_component{ Entity := NewEntity }
             NewEntity.AddComponents(array{ VerseComponent })
             Entity.AddEntities(array{ NewEntity })
 custom_verse_component<public> := class<unique><final_super>(component):
     OnBeginSimulation<override>():void =
         (super:)OnBeginSimulation()
         
         TestRoot := entity{}
         
         Entity.AddEntities(array{ TestRoot })
         NewEntity := Entities."Any Entity with a Mesh Component"{}
         TestRoot.AddEntities(array{ NewEntity })
1 Like

(post deleted by author)

I have a similar bug in my map. Instead of spawning an entity, I’m spawning a prop using SpawnProp and referencing a prop asset, but the prop is not visible and also has weird collision. Maybe it’s related. I also tested it in a different map, and the prop was visible there.

2 Likes

A workaround I found is to create a root component that adds the children, this approach also has issues with the collision of the entity, it also stops working when the spawned prefab has been placed in the editor already

test_root_component<public> := class<unique><final_super>(component):
    OnBeginSimulation<override>():void=
        NewEntity := Entities.TestPrefab{}
        Entity.AddEntities(array{ NewEntity })
        
        
custom_verse_component<public> := class<unique><final_super>(component):
    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()
        
        TestRoot := entity{}
        TestRoot.AddComponents(array { test_root_component { Entity := TestRoot } })
        
        Entity.AddEntities(array{ TestRoot })

Thank you, passing this along.

1 Like

@Nighrix How are you getting the entity with a mesh component in Verse for the following line?

NewEntity := Entities."Any Entity with a Mesh Component"{}

FORT-920732 is now ā€˜In Progress’! Our team is actively working on it!

An entity in a folder called Entities with a mesh component, with the latest update the bug seems to be solved though