Hi i am working on unity 3d app, i have an url of image and i successfully download image from that url and store into document directory path and path is: /var/mobile/Applications/4EA2C956-FCA1-4552-AEE5-611A55B26CF5/Documents/sample.jpg, now i getting stuck into how to retreive image and show on as a texture i did following code.
WWW imageToLoadPath = new WWW(/var/mobile/Applications/4EA2C956-FCA1-4552-AEE5-611A55B26CF5/Documents/sample.jpg)
//rendering texture
imageToLoadPath.LoadImageIntoTexture(mIconPlane.renderer.material.mainTexture as Texture2D);
I am getting confuse how to accomplish this task and also i want to do same videos like my path will be /var/mobile/Applications/4EA2C956-FCA1-4552-AEE5-611A55B26CF5/Documents/sampleVideo.mp4. I only want to do this task in unity 3d and in c sharp. This will be great for me. Thanks in advance.
I use this codes for load picture from documents directory, i guess you can make it with same codes
- (UIImage*)loadImage:(NSString*)imageName {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", imageName]];
UIImage *graphImage = [[UIImage alloc] initWithContentsOfFile: fullPath];
img1.image = graphImage;
return [UIImage imageWithContentsOfFile:fullPath];
}
call this method like this
[ self loadImage: "your image name"];