using Mirror; using QSB.Messaging; using QSB.WorldSync; namespace QSB.Utility.LinkedWorldObject; /// /// sent from the host to a non-host /// telling a world object and network behaviour to link /// public class LinkMessage : QSBMessage<(int ObjectId, uint NetId)> { public LinkMessage(IWorldObject worldObject, NetworkBehaviour networkBehaviour) : base((worldObject.ObjectId, networkBehaviour.netId)) { } public override void OnReceiveRemote() { var worldObject = Data.ObjectId.GetWorldObject>(); var identity = NetworkClient.spawned[Data.NetId]; var networkBehaviour = identity.GetComponent(); worldObject.LinkTo(networkBehaviour); } }