【问题标题】:I've got error CS0234 when I tried to build my 2D project in Unity当我尝试在 Unity 中构建 2D 项目时出现错误 CS0234
【发布时间】:2020-11-06 03:54:19
【问题描述】:

我是 Unity 新手,所以不要生气)

我尝试构建我的游戏,但出现了这些错误:

-Assets\Scripts\PlayerMovement.cs(5,19):错误 CS0234:命名空间“UnityEngine”中不存在类型或命名空间名称“WSA”(您是否缺少程序集引用?)

-Assets\Scripts\SpawnMovePoint.cs(4,19):错误 CS0234:命名空间“UnityEditor”中不存在类型或命名空间名称“Build”(您是否缺少程序集引用?)

-构建播放器时出错,因为脚本存在编译器错误


using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor.Build.Reporting; // Problem Line
using UnityEngine;
using UnityEngine.SceneManagement;


public class SpawnMovePoint : MonoBehaviour
{
    public Transform left, right, _point;
    float MinX, MaxX;
 


    public void Start()
    {
        MinX = left.position.x;
        MaxX = right.position.x;
    }



    public void CreatePoint()
    {
        _point.position = new Vector3(Random.Range(MinX, 
  MaxX),_point.position.y,_point.position.z);
    }
}

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine.WSA;//Problem Line


public class PlayerMovement : MonoBehaviour 

我应该怎么做才能修复它们? 我怎样才能做这些参考? 这是什么意思,'UnityEditor'中不存在什么'Build'?

【问题讨论】:

标签: c# visual-studio unity3d


【解决方案1】:

'-错误构建播放器,因为脚本有编译器错误' 这仅仅意味着脚本无法编译,因为它包含一些错误,非常简单。

你能告诉我为什么需要'UnityEditor.Build.Reporting 和 WSA 吗? 此外,您应该共享更多代码,以便我们了解您在何处以及为何使用某个命名空间,以及代码在没有它们的情况下是否可以工作。

【讨论】:

    【解决方案2】:

    请提供更多信息以帮助我和其他人了解并帮助解决您的问题。确保还展示您为尝试解决此问题所做的任何研究。

    【讨论】:

      猜你喜欢
      • 2023-03-22
      • 2021-09-15
      • 1970-01-01
      • 2020-08-17
      • 1970-01-01
      • 2021-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多