Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

AssetDatabase CreateAsset problem (Creating asset for texture)

$
0
0
Sorry for my English. I am trying to add pictures into unity asset at runtime for icon etc.

this is the error :

> Could not create texture from Assets/Textures/A.png: File could not be read>UnityEditor.AssetDatabase:CreateAsset(Object, String)>c__Iterator0:MoveNext() (at Assets/AddAsset.cs:27) this is the Code:

    IEnumerator f(string url) {
        WWW www = new WWW(url);
        string type = "";
        type = url.Substring(url.LastIndexOf('.'));
        Debug.Log(type);
        if (type[0] != '.')
            type = "." + type;
        yield return www;
        if(www.texture){
            AssetDatabase.CreateAsset(www.texture, "Assets/Textures/magica/A"+type);
        }else{
            Debug.Log("error");
        }
        Debug.Log(AssetDatabase.GetAssetPath(www.texture));
    }`
Also, the game is planning to publish on IOS and Android platform

Can I add picture by this "method" on ios and Android by the picture directory


Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>