Posts: 17
Threads: 8
Joined: Jan 2023
Reputation:
0
08-08-2025, 11:25 AM
(This post was last modified: 08-08-2025, 11:25 AM by aderae.)
Hello,
I am procedurally generating my world in 256x256 mesh chunks and whenever player is on one chunk, I am adding ObiCollider to it. However this blocks the main thread for a second and locks the game.
Is there a way to do this in Jobs system inside a thread?
Thanks!
Posts: 24
Threads: 2
Joined: May 2025
Reputation:
2
08-08-2025, 11:35 AM
(This post was last modified: 08-08-2025, 11:39 AM by chenji.)
Hi,
I think yes, what's the problem? If the block-main-thread-time is caused by creation of new object I may pre-create some objects, save them in a pool (maybe 10 objects), when the scene is loaded, and use a thread to monitor&fill that pool until the object number reaches max value (10). When you need a new object in Update() or other place in main thread, just take it from the pool, instead of creating a new one.
Also check which collider you're using. Avoid using mesh collider.
Posts: 17
Threads: 8
Joined: Jan 2023
Reputation:
0
All the chunks have different mesh so I can't pool them together. It is a runtime generated infinite world so I cannot create everything during loading as well. I am using mesh colliders for world ground I know it is expensive but I need it to be like this for realism. I can already bake Mesh collider in a thread but the moment I add ObiCollider to it, since it is a big mesh it blocks the whole game for a second which is of course not ideal.