#World.GetOrCreateSystem Issue

1 messages · Page 1 of 1 (latest)

solid anchor
#

Hello! I'm learning the basics of ECS, and looking using the Unity.Physics system to raycast a mouse position to my world to select Entities.

I'm using World.GetOrCreateSystem() from inside a managed entity to get the <BuildPhysicsWorld> system, but I'm getting an error as this function returns Unity.Entities.SystemHandle type, rather than BuildPhysicsWorld.

I've seen this pattern used in a few tutorials, and I can't see where I've diverged from the pattern. Can anyone point me in the right direction?

slim blaze
#

if you're on >= version 1.0 use SystemAPI.GetSingletonRW<PhysicsWorldSingleton>().ValueRW.PhysicsWorld

solid anchor
#

Thank you, I'll give it a go! Do you have any info on why it has changed?

slim blaze
#

you no longer need to handle dependencies with getting singleton workflow vs the old addinputdependency etc

#

its a lot simpler, it changed due to systems being made into unmanaged systems(getorcreate for a systembase is now something like GetOrCreateManaged)

#

its a much easier now, though the one line is kind of verbose