纹理在编辑器中加载但不独立加载(显示为粉红色)

Textures loads in editor but not in standalone (appears pink)

我正在使用一个名为 Simple Obj 的资产,它允许我导入一个对象,它们的材质和纹理关联。这在我的编辑器中工作正常,但在我的独立编辑器中却不行。 我的 OBJ 不在我的资源文件中,我使用 WWW 方法从另一个文件中获取它。

我是这样做的,他下载我的 OBJ,创建一个游戏对象并将其放置在我的场景中 :

private IEnumerator DownloadAndImportAllInBackground(string url, Plane newPlane)
{
    string objString = null;
    string mtlString = null;
    Hashtable textures = null;
    GameObject planeObject = null;
    bool gameObjectPerGroup = false;
    bool subMeshPerGroup = false;
    bool usesRightHanded = true;

    yield return StartCoroutine(DownloadFile(url, retval => objString = retval));
        yield return StartCoroutine(DownloadFile(url.Substring(0, url.Length - 4) + ".mtl", retval => mtlString = retval));
        if (mtlString != null && mtlString.Length > 0)
        {
            string path = url;
            int lastSlash = path.LastIndexOf('/', path.Length - 1);
            if (lastSlash >= 0) path = path.Substring(0, lastSlash + 1);
            Hashtable[] mtls = ObjImporter.ImportMaterialSpecs(mtlString);
            for (int i = 0; i < mtls.Length; i++)
            {
                if (mtls[i].ContainsKey("mainTexName"))
                {
                    Texture2D texture = null;
                    string texUrl = path + mtls[i]["mainTexName"];
                    yield return StartCoroutine(DownloadTexture(texUrl, retval => texture = retval));
                    if (texture != null)
                    {
                        if (textures == null) textures = new Hashtable();
                        textures[mtls[i]["mainTexName"]] = texture;
                    }
                }
            }
        }

    yield return StartCoroutine(DownloadFile(url, retval => objString = retval));

    if (objString != null && objString.Length > 0)
    {
        yield return StartCoroutine(ObjImporter.ImportInBackground(objString, mtlString, textures, retval => planeObject = retval, gameObjectPerGroup, subMeshPerGroup, usesRightHanded));
        planeObject.transform.localScale = new Vector3(0.0005f, 0.0005f, 0.0005f);
        if (planeObject == null)
        {
            Debug.Log("Null gameobject");
        }
        planeObject.name = newPlane.Callsign;
        planeObject.transform.position = new Vector3((float)newPlane.X, (float)newPlane.Afl / (3.2808f * 1852f), (float)newPlane.Y);
        planeObject.transform.eulerAngles = new Vector3(0, -180 + newPlane.Heading, 0);
        planeId_Object_Dictionnary.Add(newPlane.Flight, planeObject);
    }

}

这是我的 editor/standalone 中发生的事情:

粉红色外观表示您的构建缺少 material 网格渲染器组件分配或构建中缺少着色器。

如果您在运行时分配 materials 或着色器,请确保在构建中包含着色器。

您可以通过将任何着色器添加到列表中来强制 unity 包含任何着色器 Edit/ProjectSettings/Graphics