Search code examples
iosunity-game-enginephoto-gallery

How to fetch a photo from Photos Library into Unity Game on an iOS device?


I have a Unity application for iOS and I need to fetch an image from the iPhones photos library and then use it within unity as a texture/2D sprite. I can not find any information on how it could be done.

Any help is much appreciated. :)


Solution

  • For something like this, I think that you are going to need a native plugin. You can either write it yourself (maybe the harder way) or try to find one from the asset store. I don't remember if this is the case anymore, but you may need to have paid for Unity to use / create plugins however.

    If you want to try the native plugin route, which is actually a lot of fun in my experience, here is the start of the documentation for it.

    https://docs.unity3d.com/Manual/NativePlugins.html

    I would suspect that you would need to make APIs that are accessible to the Unity side of code that let you call into Objective-C which in turn would call the relevant bits of code at the platform level.