How to snap object in multiplayer Unity Netcode?
I'm using SnapInteractor to snap object to another , and how can i use it in multiplayer with netcode ? How to let all clients see that object is snapped to another ? So far the object just move with network transform ? What is the method to call with ClientRpc to let all clients snap object to another ?
I dont think there is an easy solution to this. We did a similar functionallity where each snapInteractor has a networked boolean isOccupied. When a client snaps an object somewhere, this isOccupied becomes true and you can subscribe a method to this state change for all clients to run. e.g. disable all colliders so that no one can grab the grabbable (snapInteractable) anymore.
Probably the method you are searching for is this series of calls:snapInteractor.SetComputeShouldSelectOverride(() => true, true);snapInteractor.SetComputeCandidateOverride(() => snapInteractable, true);snapInteractor.Select();
but you should know you must have ownership and you must somehow find the snapInteractable in order to give it to SetComputeCandidateOverride()