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:

1 Like

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.

2 Likes

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.

2 Likes

How do I access the gallery and select an image

1 Like

Vision OS provides enterprise APIs now, camera access being one of them. Is ArFoundation planning on also supporting that api, (provided the entitlements/license are then given correctly in the Xcode project)?

2 Likes

good question - although it seems like more of a custom plugin level integration

1 Like

I paid for a pro license to make an app for Vision Pro, but I am really frustrated because I can’t select and import photos from the gallery. When will that be possible? I am almost done with other functions, but I can’t access the gallery to import images, so I can’t make an app anymore.