internal void SendNetworkInstantiate(List <NetConnection> connections, GameObject gobj) { var netView = gobj.GetComponent <NetworkView>(); if (netView == null) { Debug.Log("[Instantiate] the specified object {0} does not have a network view to actually use for network instantiation", gobj.Resource); return; } var message = PNetServer.peer.CreateMessage(33 + (gobj.Resource.Length * 2)); message.Write(RPCUtils.Instantiate); message.Write(gobj.Resource); message.Write(netView.viewID.guid); message.Write(netView.owner.Id); var vs = new Vector3Serializer(gobj.Position); vs.OnSerialize(message); var qs = new QuaternionSerializer(gobj.Rotation); qs.OnSerialize(message); if (connections.Count > 0) { PNetServer.peer.SendMessage(message, connections, NetDeliveryMethod.ReliableOrdered, Channels.STATIC_UTILS); } }
void SendNetworkInstantiate(List<NetConnection> connections, GameObject gobj) { var netView = gobj.GetComponent<NetworkView>(); if (netView == null) { Debug.Log("[Instantiate] the specified object {0} does not have a network view to actually use for network instantiation", gobj.Resource); } var message = PNetServer.peer.CreateMessage(33 + (gobj.Resource.Length * 2)); message.Write(RPCUtils.Instantiate); message.Write(gobj.Resource); message.Write(netView.viewID.guid); message.Write(netView.owner.Id); var vs = new Vector3Serializer(gobj.Position); vs.OnSerialize(message); var qs = new QuaternionSerializer(gobj.Rotation); qs.OnSerialize(message); if (connections.Count > 0) PNetServer.peer.SendMessage(message, connections , NetDeliveryMethod.ReliableOrdered, Channels.STATIC_UTILS); }