我目前正在尝试使用 facepunch 的 steamworks 库的 p2p 库,但它给了我这个错误:
这是我的 P2P 连接代码:
using System.Collections;
using System.Text;
using System.Collections.Generic;
using UnityEngine;
using Steamworks;
public class FacePunchSteamPeerToPeer : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
SteamNetworking.OnP2PSessionRequest = (steamid) =>
{
print("Accepting User");
// If we want to let this steamid talk to us
SteamNetworking.AcceptP2PSessionWithUser(steamid);
};
SteamNetworking.OnP2PConnectionFailed = (SteamId, P2PSessionError) =>
{
print(P2PSessionError);
};
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.R))
{
byte[] mydata = Encoding.ASCII.GetBytes("Hello");
SteamId TargetSteamId = (SteamId)76561198017227431;
var sent = SteamNetworking.SendP2PPacket(TargetSteamId, mydata);
}
while (SteamNetworking.IsP2PPacketAvailable())
{
var packet = SteamNetworking.ReadP2PPacket();
if (packet.HasValue)
{
HandleMessageFrom(packet.Value.SteamId, packet.Value.Data);
}
}
}
void HandleMessageFrom(SteamId steamid, byte[] data)
{
print("Data Received");
}
}
我不知道我做错了什么或那个错误意味着什么