3

I have an image saved from my game at Application.persistentDataPath + @"/p.png" I am trying to make this visible in iOS, I have managed it in android using the Android wrappers in Unity C# but I have no idea where to start with iOS.

Is it possible for me to pass the path to my Image to iOS so that it will show up in the Photos app? If I need to write my own plugin does anyone have any decent documentation on how it's done?

geolaw
  • 412
  • 1
  • 12
  • 26

1 Answers1

2

If I need to write my own plugin does anyone have any decent documentation on how it's done?

That seems like the only way. Make a plugin that can read and write byte array to Picture folder on the iOS. You can also use already made one from here that cost $10. This plugins works with iOS, Android and Windows Phone 8 and I recommend you got with it.

The fact is that I can't write the whole process here. You first need to know how to write and read from the photo folder. Here is a link for that.

Now you need to know how to call a C# function fro Objective-C and vice versa. Many tutorials for this.

http://twnkls.com/2016/04/11/creating-native-plugins-for-unity3d/ http://alexanderwong.me/post/29861010648/call-objective-c-from-unity-call-unity-from https://www.quora.com/How-do-you-call-native-iOS-functions-from-Unity https://stackoverflow.com/a/30946257/3785314

Community
  • 1
  • 1
Programmer
  • 121,791
  • 22
  • 236
  • 328
  • Thanks for the response, with regards to that plugin, does it allow me to path to an already existing image? I have a method that writes a .png and I just want to add that image to the photos app. – geolaw Jul 13 '16 at 05:13
  • never mind I am apparently illiterate, I will look into the plugin, much obliged! – geolaw Jul 13 '16 at 05:18
  • @geolaw I will verify and reply to you. It will take hours as I am not on my development machine now. – Programmer Jul 13 '16 at 05:20
  • No worries, I bought the plugin anyways as I can use it for multiple things and it's only $10. You can't save an image by passing it a path (not that I can see anyway), but you can pass it a Texture2D instead, which will work for me. – geolaw Jul 13 '16 at 05:29
  • @geolaw You easily convert any image to Texture2D so that's not a problem. Don't forget to accept answer if your question has been answered. Happy coding! – Programmer Jul 13 '16 at 05:58