Accessing the iOS Photo Picker?

Is there a way to access the iOS Photo Picker from Unity? I want my Unity application to let the user select a picture from the Photos application or take another picture using the camera, if the device has it. I was unable to find anything about it on the documentation.

Thanks in advance.

You have to use a plugin through obj-c. It's not that hard.

  1. Hide or remove the Unity view.

  2. Add a view controller with a view to the `keyWindow`.

  3. Create a button or some event that opens an `UIImagePickerController` which you shouldn't need to subclass.

  4. Have your viewController respond to the image picker delegate.

  5. Once the user chooses an image save the image See SpinalJack's Post on getting the asset path. See below for code.

  6. In Unity, use a `WWW` to load the image from the asset path.

  7. When loading your data, the only thing you will need to remember is that WWW wants `file:` at the beginning and your plugin will not so add that after you send the asset path to your native code.


    (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo {

    NSData* imageData = UIImagePNGRepresentation(selectedImage);
    [imageData writeToFile:assetPath atomically:YES];
    [self dismissModalViewControllerAnimated:YES];
    
    

    }

How do I hide Unity View? I can’t find a simple or straight-forward answer to this…