fix: skip unsafe Fusion serialization types#1127
Conversation
📝 WalkthroughWalkthroughThis PR adds a safety mechanism to ChangesUnsafe Type Detection and Filtering
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Fixes component serialization crashes/disconnects caused by Photon Fusion IL-weaved unsafe types being accessed through reflection.
Type of Change
Save your change type
Changes Made
Type.IsByRefLikedetection so older supported Unity runtimes can still compile.Testing/Screenshots/Recordings
git diff --checkFusionUnsafeTypeSerializationTests.GetComponentData_SkipsFusionUnsafeTypesInsideContainerspassed (total=1 passed=1 failed=0)FusionUnsafeTypeSerializationTests.GetComponentData_SkipsFusionUnsafeTypesInsideContainerspassed (total=1 passed=1 failed=0)NetworkBall/NetworkRig_SharedModesuccessfully.NetworkBall.prefabandNetworkRig_SharedMode.prefabsuccessfully.Fusion.NetworkObject,Fusion.NetworkTransform,Fusion.Addons.Physics.NetworkRigidbody3D,Fusion.XR.Host.Rig.NetworkRig, and Gorimon customNetworkBehaviourcomponents without Editor crash.Documentation Updates
tools/UPDATE_DOCS_PROMPT.md(recommended)tools/UPDATE_DOCS.mdRelated Issues
Fixes #1128
Additional Notes
The project declares Unity 2021.3 support, but Unity 2021.3.45f2 is not installed on this machine. I avoided a direct dependency on
Type.IsByRefLikeby using reflection and validated on the installed 2022.3.62f1 and 6000.0.41f1 editors.Summary by CodeRabbit
Bug Fixes
Tests