Run multi-scenes on new thread
I understand unity is single threaded but I need each scene in the hierarchy to run simultaneously.
I'm using this to create new physics scene CreateSceneParameters csp = new CreateSceneParameters(LocalPhysicsMode.Physics3D); Scene scene = SceneManager.CreateScene(name, csp);
However it appears operations in FixedUpdate() for each of those scenes, are waiting for the previous scene to finish its operations, before it resumes in other scripts, even though they are in completely different scenes.
Answer by Edy · May 05 at 10:40 PM
That's not possible in Unity. There's a single "scene space", even if it's composed of multiple logical scenes. All them run as if they were one single scene. Most of Unity API can be called only from the main thread. The code in FixedUpdate (and most of the other MonoBehaviour callbacks) couldn't use the Unity API in the same way if they were called from a different thread.
All you can do is either use your own threads (discouraged, come with typical problems of multithreading) or use the Job System to "jobify" specific tasks that would be executed in multiple threads automatically.
Ah.. thank you so much for the clarification! Wish I was knew that prior to making room-based system for multiplayer. Guess I'll just do multiple instances with different ports, unless there is a better way of accomplishing this?
Your answer
Follow this Question
Related Questions
How does hinge joint work? 0 Answers
Two Vectors Beetween Angle 0 Answers
Move rigidbody cube without it tumbling 2 Answers
Can I ignore part of a vector3 for physics reasons? 0 Answers
Mixing physics and path... 0 Answers