[Released] Aperture - iOS Screen Capture

I just released my first plugin: Aperture. Super creative name, I know. Anyway, it does screen capture. Fast.

Features:

  • Writes to camera roll, disk, or a texture
  • Optional capture preview
  • Supports MSAA!
  • Compatable with Vuforia and other AR libraries

The built in capture preview displays in a native iOS view over top of your game. You can easily modify it in Xcode if you want to change it’s appearance or behaviour. You have control over how it animates in, and whether or not it pauses Unity in the background. Or, you can not show it at all, and just save directly to the users Camera Roll, or to disk. If you do want to show a preview, and just not the native one, you can also save your photo straight into a Texture2D and display it in your Unity UI.

Documentation is available online: http://scarlet.io/docs/aperture.html

[[ Get it on the Asset Store ]

](Aperture - iOS Screen Capture | Tools | Unity Asset Store)

Thanks for the plugin.

Is there a way from the plugin to specify a Layer to ignore ? I am trying to get a screenshot but need to hide some object when that happens;

Not directly. The capture happens after the entire screen is rendered. However, there is a callback that gets fired just before the screenshot is taken, for exactly this reason. In the callback, you can disable objects you don’t want to show in your screenshot (or just change the layermask on your camera). When the capture completes, there’s another callback so you can turn things back on.

void Start () {
	originalMask = camera.cullingMask;
}

void OnPhoto() {
	camera.cullingMask = 0; // don't draw anything 
}

void OnCaptureComplete() {
	camera.cullingMask = originalMask;
}

Hi cbaltzer, could you explain further what you describe above?

I’ve tried setting up the layers as described above and it seems to turn off my GUI.

That’s the intent. You probably don’t want to capture your GUI in your screenshots, so, you can listen for the capture events in order to toggle it on and off. There’s a bunch of ways to do this, including changing the culling mask on your GUI camera. The important part is to make sure that you set the culling mask back to what it was initially (in OnCaptureComplete()), otherwise your GUI will just disappear forever.

If you do want to show your GUI but not some other objects, you can either: put them on separate cameras, change the culling mask to draw only some layers, or just SetActive(false) the objects you want to hide.

Just as a warning, Aperture does not currently work with Unity 4.5. It will build, but screenshots capture black. Working on a fix!

Edit: Fixed, see post below!

I have a temporary fix for Unity 4.5, just PM me your invoice number and I’ll send you the patch! You can also email supportscarlet.io.

Version 1.6.1 is now out. It includes support for Unity 4.5 and some bug fixes! Aperture - iOS Screen Capture | Tools | Unity Asset Store

Unfortunately, a bunch of OpenGL related items got renamed in Xcode 6. This means that current versions of Aperture will throw errors. A fix for the Asset Store is coming, but in the mean time email support@scarlet.io if you need a temporary patch!

I’d like to change the “use” button on the screen preview to “share”. Or at least change it to “save” and add a button for “share” for Facebook. Is this possible?

Yes, you can just edit the .xib for the preview screen in Xcode and change the label on the button to say “Share” or whatever you’d like. Set the save mode on Aperture to “DiskPhotoLibraryPreview” and it will save to the camera roll and pass back the path to the photo in the use/share button callback, which you can use to post to Facebook.

1 Like

Thanks cbaltzer. I was able to change the button name to share no problem. Aperture is set to DiskPhotoLibraryPreview and is set to not pause Unity. But I’m a little lost on the callbacks.

I wrote a script completely separate from this which allows users to log in and out of Facebook, post screenshots and include text in the post with the image. This is all working perfectly, however, I want to access this functionality while looking at the screen preview generated by Aperture.

I see OnComplete and SavedToDisk in the callback section in Aperture.cs. How do I call one of these during the screen preview (and which should it be)?

Your Facebook script can listen for OnSavedToDisk() to get the path to the screenshot, then you would use OnAcceptedPreview() to actually trigger the posting. The use button in the preview triggers OnAcceptedPreview(), and the cancel button triggers OnCancelledPreview().