mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 05:17:13 +08:00
19 lines
510 B
C#
19 lines
510 B
C#
|
|
using Network;
|
||
|
|
using System.Text;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Test
|
||
|
|
{
|
||
|
|
public class UdpClientTest : MonoBehaviour
|
||
|
|
{
|
||
|
|
private async void Start()
|
||
|
|
{
|
||
|
|
var sendBytes = Encoding.UTF8.GetBytes("Test 汉语 and English simultaneously!");
|
||
|
|
|
||
|
|
var receivedBytes = await UnityUdpClient.Instance.SendAndReceiveData(sendBytes);
|
||
|
|
var receivedString = Encoding.UTF8.GetString(receivedBytes);
|
||
|
|
|
||
|
|
Debug.Log($"Received string: {receivedString}");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|