【问题标题】:UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors (Deploying to WebGL)UnityEditor.BuildPlayerWindow+BuildMethodException:3 个错误(部署到 WebGL)
【发布时间】:2022-09-28 09:08:30
【问题描述】:

所以我收到了这个错误:

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002cc] in <3371b3e2e5754acd87e600e068350da5>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <3371b3e2e5754acd87e600e068350da5>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

我在谷歌上查找了错误,但没有得到任何答案。游戏在统一编辑器中运行良好。

该错误表明构建播放器很多,所以我认为这是构建播放器时的编译错误。我正在使用 Photon Player Scripts 和他们的游戏管理器脚本。 (光子语音 2、光子聊天、光子融合、光子实时)

无论如何,这里是脚本:

using UnityEngine;
using Photon.Pun;

public class GameManager : MonoBehaviour
{
    public GameObject playerPrefab;

    void Start()
    {
        PhotonNetwork.Instantiate(playerPrefab.name, new Vector3(Random.Range(-5f, 5f), Random.Range(3f, 5f), Random.Range(-5f, 5f)), playerPrefab.transform.rotation);
    }
}

我有 2 个场景:\"Connect&Lobby\" 和第二个场景 \"Main\"

此外,这里有一些高于此错误的错误(但我确信这些不会导致构建问题):

构建播放器时出错,因为脚本存在编译器错误 Assets\\Photon\\PhotonVoice\\Demos\\DemoVoiceUI\\Scripts\\MicrophoneDropdownFiller.cs(110,28):错误 CS0103:名称 \'Microphone\' 在当前上下文中不存在

我已经处理这个问题几天了,现在真的很烦人。

此外,播放器脚本肯定没有编译器错误:(看一看)

using UnityEngine;
using Photon.Pun;
using TMPro;
using UnityEngine.SceneManagement;


public class Player : MonoBehaviour
{
    public PhotonView photonView;
    public GameObject usernameCanvas;
    public TMP_Text usernameText;

    void Awake()
    {
        if (photonView.IsMine)
        {
            usernameText.text = PhotonNetwork.NickName;
        }
        else
        {
            usernameText.text = photonView.Owner.NickName;
        }
    }

    void Update()
    {
        if (!photonView.IsMine)
        {
            usernameCanvas.SetActive(true);
        }
    }
}

    标签: c# unity3d webgl


    【解决方案1】:

    错误The name 'Microphone' does not exist in the current context 是您无法构建项目的原因(至少,这是原因之一,也许还有更多原因)

    根据unity3d documentation,WebGL 不支持Microphone 类。

    我看到了this page,但我自己没有测试。无论如何,你可以试一试=)

    【讨论】:

      【解决方案2】:

      您的 pc 或笔记本电脑还有其他问题,一些安全或 vpn 应用程序不允许您构建统一项目,只需检查您的 pc 并再次构建它

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-01-15
        • 2018-02-03
        • 1970-01-01
        • 2015-07-22
        • 1970-01-01
        • 1970-01-01
        • 2012-05-16
        • 2021-09-22
        相关资源
        最近更新 更多