BitStream在2018.3中已过时,而unity要求改为使用MultiPlayer或NetworkIdentity,但我无法在上述类中找到合适的功能。我试图替换类“ Bit Stream”,但它不起作用
void OnSerializeNetworkView(BitStream stream)
{
Vector3 syncPosition = Vector3.zero;
if (stream.isWriting)
{
syncPosition = GetComponent<Rigidbody2D>().position;
stream.Serialize(ref syncPosition);
syncPosition = GetComponent<Rigidbody2D>().velocity;
stream.Serialize(ref syncVelocity);
}
else
{
stream.Serialize(ref syncPosition);
stream.Serialize(ref syncVelocity);
syncTime = 0f;
syncDelay = Time.time - lastSynchronizationTime;
lastSynchronizationTime = Time.time;
syncEndPosition = syncPosition + syncVelocity * syncDelay;
syncStartPosition = GetComponent<Rigidbody2D>().position;
}
}
错误:
Assets \ Scripts \ Multiplayer.cs(26,30):错误CS0619:“ BitStream”为 已过时:'旧网络系统已在Unity中删除 2018.2。改用Unity Multiplayer和Network Identity。'