Unity 网络脚本问题

问题描述

我有一个多人游戏,它是使用 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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...