I have tried to load a resource from file in unity web player and in the unity standalone to no avail. All resources are in my resources sub folders, (maybe this is wrong?):![alt text][1]
[1]: /storage/temp/55722-assets.png
What happens instead of loading the images is nothing. I think maybe the core issue is the fact I have to load from file using System.IO. The reason being why I have to use that is I know no way of converting a Texture2D type to a System.Drawing.Image type to display my gifs, in unity. It also might be the methodology behind getting the path of the files as shown by my code snippet here:
private string[] pathGen()
{
loadingGifPath = Application.dataPath + "/Resources" + "/Sprites/" + "Front/" + pName + ".gif";
string temp = "Sprites/" + "Front/" + pName + ".gif";
string temp2 = Application.dataPath + "/Resources" + "/Sprites/" + "Front/";
string temp3 = pName + "*";
string[] path = Directory.GetFiles(temp2, temp3);
return path;
}
public void loadImage()
{
string[] path = pathGen();
Debug.Log (path[0]);
Debug.Log(loadingGifPath);
//Debug.Log(Resources.Load(temp));
System.Drawing.Image gifImage = System.Drawing.Image.FromFile(path[0].ToString());
Any help would be much appreciated to solve my path issue, or any knowledge of how to convert a Texture2D to a System.Drawing.Image. Any other ideas also much appreciated and thank you in advance.
↧