Unity: “NetworkBehaviour” is missing

狂风中的少年 提交于 2020-12-13 04:01:44

问题


I try to run the sample project from google AR Core here.

There is error in the sample code.

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

using GoogleARCore;
using GoogleARCore.CrossPlatform;
using UnityEngine;
using UnityEngine.Networking;

/// <summary>
/// A Controller for the Anchor object that handles hosting and resolving the Cloud Anchor.
/// </summary>
public class AnchorController : NetworkBehaviour
{
    ....

I am using the 2020.1.0f1 version. What can I do to fix this? It is said deprecated while the new replacement is still under development.

Deprecated but cannot be used and there is no replacement at the moment. I am stuck here.


回答1:


use Window > Package Manager to install the Multiplayer HLAPI and XR Legacy Input Helpers packages.




回答2:


For Unity 2020, I used Window > Package Manager and pressed the + (plus) sign: Add Package from git URL and set it to:

  • com.unity.multiplayer-hlapi

and

  • com.unity.xr.legacyinputhelpers

as it was recommended here: https://medium.com/@jeffreymlynch/where-are-the-missing-preview-packages-in-unity-2020-3ad0935e4193




回答3:


Never mind the Multiplayer HLAPI and XR Legacy Input Helpers only available in unity version < 2020. In 2020 version, there is no option to install them both. The solution is I just downgrade the version into 2019.



来源:https://stackoverflow.com/questions/63260859/unity-networkbehaviour-is-missing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!