如何在iOS设备上将照片从照片库提取到Unity游戏中? [英] How to fetch a photo from Photos Library into Unity Game on an iOS device?
问题描述
我有一个iOS的Unity应用程序,我需要从iPhone的照片库中获取图像,然后将其统一用作纹理/2D精灵.我找不到有关如何完成操作的任何信息.
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. :)
推荐答案
对于这样的事情,我认为您将需要一个本机插件.您可以自己编写(可能更困难),也可以尝试从资产商店中找到它.我不记得这种情况了,但是您可能需要为Unity付费才能使用/创建插件.
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
我怀疑您将需要使Unity端的代码可访问的API可以让您调用Objective-C,而后者又会在平台级别调用相关的代码位.
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.
这篇关于如何在iOS设备上将照片从照片库提取到Unity游戏中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!