join us on Discord for support, updates, and all things Snap AR! See you there!
CameraKit For Unity - Controlling CameraKit Android UI when Rendermode is BehindUnity
Hello,
I've been playing around with CameraKit For Unity for a while now, and currently I'm in the stage of controlling the Unity UI and the Snapchat UI.
We are able to launch CameraKit with rendermode BehindUnity, which is really cool because then we can keep rendering the game UI while having the Snapchat view open, but I'm running into issues with this rendermode:
I want to be able to take video's and snaps with the shutterbutton, but I am unable to press the button when the rendermode is BehindUnity.
Is there a workaround for this? I was thinking of 2 solutions:
- Create an additional framelayout with a higher Z-index than Unity with just the snap button, and recreating the interaction logic for taking images and videos.
- Recreate the Snap button in the Unity UI and calling
(imageProcessorSource as? AllowsSnapshotCapture)?.takeSnapshot(onImageTaken)
with native calls. But I am not sure it the app will pass review then, since I'm then recreating the snapchat UI.
Answers
-
Hi!
Thanks for bringing this feedback. It highlights the importance of adding a Unity API to call takeSnapshot on the native apps. We will consider adding this to the demo app.
The second option is definitely what I would recommend. If for some reason the callback with the image is not activated automatically, you can just invoke this, with the generated image:
UnityPlayer.UnitySendMessage("CameraKitHandler", "MessageCameraKitCaptureResult", generatedImage.absolutePath)
1 -
Thanks @Edgar Neto and @Pico Alta !
0