0
이 코드는 다른 사람으로부터 원시 데이터를 받아 변환합니다. 지금 당장 다른 플레이어가 추가 한 오브젝트를 다른 플레이어가 두 번째 플레이어 화면에 추가 한 오브젝트에 추가해야합니다.피어 투 피어 (Peer to Peer) 연결을 통해 GameObject가 가진 어떤 부모에 관한 데이터를 전달합니까?
public void OnRealTimeMessageReceived(bool isReliable, string senderId, byte[] data)
{
byte messageVersion = (byte)data[0];
// Let's figure out what type of message this is.
char messageType = (char)data[1];
if (messageType == 'U' && data.Length == _updateMessageLength)
{
float posX = System.BitConverter.ToSingle(data, 2);
float posY = System.BitConverter.ToSingle(data, 6);
// We'd better tell our GameController about this.
if (updateListener != null)
{
updateListener.UpdateReceived(senderId, posX, posY);
}
}
}
이 코드는 google play 서비스를 통해 다른 플레이어에게 메시지를 보냅니다.
public void SendMyUpdate(GameObject childObj)
{
_updateMessage.Clear();
_updateMessage.Add(_protocolVersion);
_updateMessage.Add((byte)'U');
_updateMessage.AddRange(System.BitConverter.GetBytes(childObj));
byte[] messageToSend = _updateMessage.ToArray();
PlayGamesPlatform.Instance.RealTime.SendMessageToAll(false, messageToSend);
}
이 게임은 박하 사탕 발가락 같은 간단한 게임을 위해 박하 사탕 발가락
다른 플레이어에게 넘겨 주기로 결정했지만 여전히 데이터가 나타나지 않아 디버그가 트리거되지 않습니다. 나는 adb logcat을 사용하고있다. –