Unity - A计划(一年有效期) 扫二维码继续学习 二维码时效为半小时

(61评价)
价格: 2208.00元
Asset Bundle打包时出错
呃呃发起了问答2019-03-01
2
回复
1606
浏览

老师您好!我在学Asset Bundle时,跟着教程走的,在打包时就会如下报错:

报错1:

Assets/NewBehaviourScript.cs(5,4): error CS0246: The type or namespace name `MenuItem' could not be found. Are you missing an assembly reference?

报错2:

Assets/NewBehaviourScript.cs(13,5): error CS0103: The name `BuildPipeline' does not exist in the current context
报错3:

Error building Player because scripts had compiler errors

 

代码如下:

using System.IO;
using UnityEditor;

public class CreateAB  {
  [MenuItem("Assets/BuildAB")]
  static void BuildAB()
  {
    string dir = "AssetBundles";
    if (!Directory.Exists(dir))
    {
      Directory.CreateDirectory(dir);
    }
    BuildPipeline.BuildAssetBundles(dir, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
  }
}

请老师解答。

所有回复
发表回复
你还没有登录,请先 登录或 注册!