问题描述
我有一个多人游戏,它是使用 Unity 编辑器构建的,但大约是 8 年前。编辑器内的网络内容已更新,我被一个错误困扰,如下所示:
Assets\General Scripts\Move.cs(58,33):错误 CS0619:“网络”已过时:“遗留网络系统已在 Unity 2018.2 中删除。改用 Unity Multiplayer 和 NetworkIdentity。'
我已经玩了几个小时了,似乎我只是缺少一个“使用”语句。以下是导致错误的代码,任何指针都会有所帮助。
using UnityEngine;
using System.Collections;
public class Move : MonoBehavIoUr {
Vector3 veLocity;
int speed;
string playerClone;
GameObject Player;
Transform avatar0;
public int health;
// Use this for initialization
void Start ()
{
speed = 3;
health = 100;
}
// Update is called once per frame
void Update ()
{
if (health <= 0)
{
die();
}
if (Input.GetKey("up"))
{
veLocity = Vector3.forward * speed;
transform.Translate(veLocity * Time.deltaTime);
}
if (Input.GetKey("down"))
{
veLocity = Vector3.back * speed;
transform.Translate(veLocity * Time.deltaTime);
}
if (Input.GetKey("left"))
{
transform.Rotate(0,-2,0);
}
if (Input.GetKey("right"))
{
transform.Rotate(0,2,0);
}
}
void OnLoaded()
{
Network.Instantiate(avatar0,transform.position,transform.rotation,0);
playerClone = "Player(Clone)";
Player = GameObject.Find(playerClone);
}
void OnPlayerdisconnected (Network player)
{
Move.Instantiate(Player);
Network.DestroyPlayerObjects(player);
}
void die()
{
Destroy(this.gameObject);
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)