PhysicsSceneExtensions.SetPhysicsScene for network simulation

To test multi peer in single Unity Editor instance I need PhysicsSceneExtensions.SetPhysicsScene method
so I can create new scene with its own physics world and then set that world to newly loaded scenes.
Looks like it must be very easy to do this on C++ side.

My goal is:
scene_01_host - physicsWorld_01
scene_02_host - physicsWorld_01
scene_03_host - physicsWorld_01

scene_01_peer - physicsWorld_02
scene_02_peer - physicsWorld_02
scene_03_peer - physicsWorld_02

Is there any way to do this today?

@MelvMay can you help with this please? :slight_smile:

Not sure how I can help but the only way to create/load a scene with its own dedicated physics “world” is to use the overloads that allow you to specify the LocalPhysicsMode.

Changing the physics “world” everything in a scene is using is highly non-trivial and it’d be quicker to just load it that way. You could also create an empty scene with its own physics “world” then move all the root objects in the scene to it but again, that’s not going to be as cheap as just loading it that way.

Thanks

Is it possible/easy, at least theoretically, to add API that receives PhysicsScene handle in LoadScene so scene will be loaded with connection to exact physics world, instead of creating new one or using default?

It’s possible yes. For now in the absence of asking for a local physics scene, it just defaults to the primary one.

Cool :slight_smile:

Please push this request on Unity Tasks side, it will make life on Unity GO side + networking way better :slight_smile:
It will be amazing if such feature lands into Unity 6 and if it will be backported to 2022 mmmm :slight_smile:

Please take a note here if such feature will be at least planned for some Unity version :slight_smile:
Thanks for your time :slight_smile:

I can mention it but I have no power to see that feature implemented nor can I promise it’ll be done.

Features are never backported in Unity, only bug fixes.

1 Like