老项目升级之后报错:

error CS0246: The type or namespace name 'NetworkManager' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'NetworkManager' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'NetworkLobbyManager' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'NetworkConnection' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'NetworkMessage' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'NetworkBehaviour' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'NetworkTransform' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'CommandAttribute' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'Command' could not be found (are you missing a using directive or an assembly reference?)

error CS0115: 'LobbyManager.OnStartHost()': no suitable method found to override

error CS0115: 'LobbyManager.OnMatchCreate(bool, string, MatchInfo)': no suitable method found to override

error CS0115: 'LobbyManager.OnDestroyMatch(bool, string)': no suitable method found to override

error CS0115: 'LobbyManager.OnLobbyServerSceneLoadedForPlayer(GameObject, GameObject)': no suitable method found to override

error CS0115: 'LobbyManager.OnLobbyServerPlayersReady()': no suitable method found to override

error CS0246: The type or namespace name 'MessageBase' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'MessageBase' could not be found (are you missing a using directive or an assembly reference?)

error CS0115: 'LobbyPlayer.OnClientEnterLobby()': no suitable method found to override

error CS0115: 'LobbyPlayer.OnStartAuthority()': no suitable method found to override

error CS0115: 'LobbyPlayer.OnClientReady(bool)': no suitable method found to override

error CS0246: The type or namespace name 'SyncVarAttribute' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'SyncVar' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'hook' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'SyncVarAttribute' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'ClientRpcAttribute' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'ClientRpc' could not be found (are you missing a using directive or an assembly reference?)

因为unity已经弃用了自带的Network,所以会报错,建议直接删除原来相关脚本。

如果有不想删除的话。

打开“Window”>“package Manager”,然后在弹出的窗口左上角按+(加号):Add Package from git URL

在加号下面显示的文本框里输入com.unity.multiplayer-hlapi。文本框右侧的add按钮会亮起,点击安装。package Manager界面右侧会显示安装状态,安装完毕上述全部关于Network的错误都消失了。