- Home /
Load streamingassets from non ienumerator method ?
Hi, i have some trouble for a couple days and i cant see the way out from this :s
i want to create a script. it will be use for load image from streamingassets folder
i simplified the script to be like this.
 public class ImageLoader : MonoBehaviour
 {
 private Texture2D _texInMemory;
 
 public Texture2D GetImage(string fileName)
 {
 StartCoroutine(LoadImage(fileName));
 
 return _texInMemory;
 }
 
 Ienumerator LoadImage(string fileName)
 {
 var path = somestring;
 WWW uri = new WWW(path);
 yield return uri;
 
 _texInMemory = uri.texture;
 }
i want another script can take Texture2D from "_texInMemory" from GetImage method. now everytime i call method GetImage, it will always return null I think this is because LoadImage method still on work and has not been load the texture from WWW.
my question is what line i need to add in GetImage method / ImageLoader class so another script can get _texInMemory from GetImage Method ?
thanks before and sorry for my bad english
Answer by metallizard · Jun 29, 2015 at 09:25 PM
After waiting for this question to get some answer.. i found it myself with help from a friend.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                