VRChat UdonSharp Magnet
- Digital500 JPY




Magnet for VRChat UdonSharp that can be attached/snapped to any collider or only specific colliders via customizable layer mask and a collider array to be used. Drops if it doesn't find a valid collider to attach to.
Changelog
V1.3.2 Fix some errors that could happen if not setup correctly with logs and so. Shows the arrow as pointing with max length. V1.3.1 (script says 1.3.0 sorry) Added Yellow Arrow on attachment point indicating where it'll attach from. Also uses Required Components attribute to make sure all exists before adding magnet component V1.3.0 Updated example and code to latest as of 2026-10-09. Using [NetworkCallable] for playing sound with only 1 function/method instead of two separate ones. V1.2.2 Everything is now pretty much udonsharp only... Stop checking collision while already attached v1.2.1 (UdonSharp Only) It'll now keep a fake Parent <> Child relationship so it keeps following the parent without actually being parented v1.2 (UdonSharp Only) Can now be thrown and check for attachment on collision. Also got detachment clips you can turn on too v1.1 (UdonSharp Only) Can now set it to parent itself to whatever it attaches itself to
Setup
Requires VRCObject sync, Rigidbody, Collider, VRCPickup to be added along with the Magnet UdonBehaviour. Add a child object and make sure the blue arrow points towards where you want it to attach from. as of 1.3.x there's a yellow arrow pointing towards where it'll attach from Can then choose which layers it should attach to and also if it should be limited to specific colliders or not. Includes Example Scene




