Towellie
Towellie3mo ago

Improve performance of RealtimeTransforms in Rigidbody mode.

Original post and all credit goes to @liamc https://discord.com/channels/393839515074297858/677646675560366141/1046741601826914305
I wrote a script that attaches to a RealtimeTransform in Rigidbody mode and gives me a roughly 3x improvement in the FixedUpdate performance. It's just a prototype for now, i haven't tested it thoroughly and there could be edge cases i haven't considered yet. Plus its using reflection so it could completely break if a method gets renamed in a future normcore update. But I think some of the principles could be safely applied to the normcore source without changing any behaviour and breaking backwards compatibility . E.g, caching the results of the model null check and model.isOwnedLocallySelf instead of calling them twice. https://gist.github.com/liamcary/628e5c4833ae0ba18c2c570992aeb993 This has been reliable for Realtime prefab instances in my project, but I haven't tested SceneView RealtimeTransforms with Rigidbodies. This is the profiler sample that sent me down this rabbit hole. About half of it is isOwnedLocallySelf, so caching the result instead of getting that property twice would be an instant 25% saving
Gist
A script to improve performance of RealtimeTransforms in Rigidbody ...
A script to improve performance of RealtimeTransforms in Rigidbody mode. This is a prototype, I haven't tested it thoroughly for production. - RealtimeTransformOptimizer.cs
No description
0 Replies
No replies yetBe the first to reply to this messageJoin