I’m trying to use the method outlined here to load an image file as a texture. However, while that example deals with a website, I’m trying to use a local path instead.
My path may be something like this: “H:\images
ewimage.png”
However, if I try to use the aforementioned method for this type of path, it doesn’t work. The function just waits indefinitely for the file to ‘download’.
What should I be doing instead? www.LoadImageIntoTexture() is the only method I could find for creating a texture from an external image file, but it seems useless if you’re not loading it from an actual URL.
Edit: Okay, in one of the related questions, I found this method which seems more suitable for what I’m trying to accomplish.
tex = Resources.Load(filepath) as Texture2D;
Debug.Log("Loaded texture: " + tex);
However, running this method doesn’t actually seem to load the texture at all. The output just looks like
Loaded texture:
I also tried adding “file://” to the start of the filepath string, but that didn’t seem to help.
Since Unity 2017, Texture2D.LoadImage has been replaced by [ImageConversion.LoadImage][1]. [1]: https://docs.unity3d.com/ScriptReference/ImageConversion.LoadImage.html
– EdyNo, because the answer is not as simple as "yes"/"no", and legal issues are important to get correct. I suggest you consult a lawyer or interpreter if you are unable to understand the conditions in the link I gave.
– tanoshimi