When traveling if the parent entity transform gets too far from the player it gets disabled disabling all it’s children even if they are close to the player.
Please select what you are reporting on:
Creative
What Type of Bug are you experiencing?
Assets
Steps to Reproduce
blank project
check scene graph in settings
add empty entity as parent.
add children to it.
get far away from the parent.
Expected Result
Disabling only the parts that need to be optimized but not all if there are close objects to the player
Observed Result
Parent gets disabled making all children also disabled
I have a component that Saves the children entities in an array when OnAddedToScene is called also retrieve the simulation entity and set all the children as the child of the simulation. If I try this step at OnBeginSimulation or OnSimulate they get destroyed as if they were called from RemoveFromParent. Then I can query for components or setup references or control the children based on the array saved. Hope it helps.
using { /Verse.org/Simulation }
using { /Verse.org/SceneGraph }
take_children_out := class<final_super>(component):
var Children : []entity = array{}
#After this you can query for components so can't call get components on these phase.
OnAddedToScene<override>():void=
(super:)OnAddedToScene()
set Children = Entity.GetEntities()
if(SimulationEntity := Entity.GetSimulationEntity[]):
SimulationEntity.AddEntities(Children)
#Now you can query components
OnBeginSimulation<override>():void=
(super:)OnBeginSimulation()
var Count : int = 0
for(Child: Children, Comp := Child.GetComponent[my_component]):
set Count += 1
Print("Components Found [{Count}]")
#In case on need for suspends or wait for other things.
OnSimulate<override>()<suspends>:void=
(super:)OnSimulate()
I have detected a problem with this approach now, if you need collision detection on some of the children, the events are not triggering after doing this on the mesh components