使用www加载的坑

来源:互联网 发布:淘宝哪家杂货铺好 编辑:程序博客网 时间:2024/06/14 13:46

使用www加载资源,无论是在PC端还是移动端都要在路径前面加“file://”

例如:

/// <summary>
    /// 本地存储路径
    /// </summary>
    public static string WWWPathURL
    {
        get
        {
            string path = "";
            if (Application.platform == RuntimePlatform.Android)
                path = "file://" + Application.persistentDataPath + "/";// "jar:file://" + Application.dataPath + "!/assets/"
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
                path = Application.persistentDataPath + "/";// Application.dataPath + "/Raw/";(暂时不确定这个坑)
            else if (Application.platform == RuntimePlatform.WindowsEditor)
                path = "file:///" + Application.streamingAssetsPath + "/";
            return path;
        }
    }

0 0
原创粉丝点击