Can an visionOS unity app access any camera data?

I would like to access any of the cameras to be able to take a quick picture of the real world from within my app - I’ve read lots of articles saying there was no access, but then there are the ARFoundation calls that make it seem like I can get image data from the CPU with a (TryAcquireLatestCpuImage) call that returns a XRCpuImage.

I would appreciate a definite answer :slight_smile:

No it’s not possible, AR Foundation is a cross platform framework but not all API’s are supported or return valid data on all platforms. That API should work on iOS and Android but not visionOS.

cameraManager.TryAcquireLatestCpuImage(out XRCpuImage image)

should return false on visionOS. If it does not please file a bug and post the IN-XXXXX number here for us to follow up on.

You’re correct, it does return false - proper boolean response :slight_smile:

Another question if you have time, my immediate thought is to access the photo library on-device to allow users to take a picture of the content desired, and then select it through my app so that I can get the data (just not on-demand). You would normally do that through PhotoKit (and PhotoKit is an option for visionOS 1.0+) so are there methods I can find in Unity to be able to populate that data? I looked for ~relative classes that might be able to do something similar but didn’t find anything super close when I looked, but I am very new to unity so I might’ve overlooked it.

Thanks!

Not out of the box no. You’ll need to write a native plugin and manage the data and visualization yourself. Unity has some C# API’s for accessing device specific or OS things but a user’s photos / image gallery isn’t covered.

1 Like

How do I access the gallery and select an image