Fit it into your game
A photo is an event. The kit captures it, recognises what is in it, judges it, responds and presents it, and every one of those five steps can be switched off or replaced. This page shows how to bend it to your game.
The five steps #
| Step | What happens | Switch it off | Replace it |
|---|---|---|---|
| Capture | The shutter fires; the moment becomes data and, usually, a picture. | Storage: Make Pictures off. | Take photos from your own code with Capture or PhotoShoot.Take. |
| Recognise | The camera works out which subjects are in the picture. | Recognition: Off. | Mark objects photographable or not at any time. |
| Evaluate | The photo is judged. | Scoring mode Off or Identify Only. | A custom scorer, or change the result in PhotoEvaluated. |
| Respond | Requests complete, the journal fills, your events run, the photo is kept or not. | Requests off, Journal off, Album off. | DecideKeep, Photo Triggers, the events below. |
| Present | The built-in screens show it. | Screens: each one, or all. | Your own UI on the same events. |
Six setups are checked by automated tests on every release, so they stay possible: no built-in UI, no scoring, no recognition, nothing saved, your own camera, and your own rule for what is kept.
Common setups #
A quest that needs a photo, and nothing else. Starting point Photo Quests. Make the quest object photographable, add a request with "Photograph It", and wire a Photo Trigger (Request Completed) to your quest system.
Photos as evidence in a stealth game. Starting point Stealth Evidence. Film is limited, photos pass or fail. Add details to subjects (a face, a document) and ask for them with the Shows Detail rule.
The camera as a weapon. Starting point Ghost Combat. Nothing is kept. Listen to PhotoEvaluated, or put a Photo
Trigger on each ghost with When set to This Object Photographed and use the score as damage through its On Score
event.
Only a photo mode. Starting point Creative Photo Mode. The handheld camera, scoring, requests and journal are off.
A collection game. Starting point Wildlife Discovery or Scrapbook. Fill the catalog with subjects and behaviours; the journal does the rest.
A ride photo or a security camera. Place a Photo Spot where the camera should be and call its Capture() from a
trigger. Show the result on a Photo Display by the exit.
A third-person game with a character to pose. Set Photo Mode Focus to the character and list it under Hideable In Photo Mode: players can orbit it, or hide it for a clean landscape.
Your own everything. Starting point Headless. No screens, no keys. Call the camera from your code and read the results.
Events with no code #
The Photo Camera has UnityEvents for Opened, Closed, Photo Taken, Photo Kept, Photo Discarded, Photo Saved and Shot Refused.
A Photo Subject has On Photographed.
A Photo Trigger (Add Component > Photoworthy > Photo Trigger) reacts to photos anywhere in the scene:
| When | Fires for |
|---|---|
| Any Photo Kept | Every kept photo. |
| This Object Photographed | A kept photo that shows this object's own Photo Subject. |
| Subject Photographed | A kept photo that shows a kind of subject. |
| Request Completed | A request being completed. |
| Subject Discovered | A subject photographed for the first time. |
| Rules Met | A kept photo that meets rules listed on the trigger (the same 18 rules as requests). |
| Any Photo Taken | Any photo, kept or not, as soon as it is judged. |
Each trigger has an On Photo event, an On Score event that passes the score as a number, and a Once switch.
Events in code #
PhotoEvents raises every step, in this order:
| Event | When |
|---|---|
| CameraOpened, CameraClosed | A camera screen opens or closes. |
| CaptureRequested | The shutter fired. Nothing is judged or saved yet. |
| PhotoEvaluated | Recognised and judged. Change the photo here to overrule the result. |
| PhotoAccepted or PhotoRejected | Kept, or not. |
| SubjectDiscovered, BehaviourDiscovered, NewBestShot, RequestCompleted | What the kept photo changed. |
| PhotoSaved | The picture file is safely on disk. |
Your own camera #
The Photo Camera borrows whatever camera you give it, so it works with any controller, including Cinemachine: give it the Unity Camera that renders the game. While a screen is open the kit sets the field of view and, in the photo mode, the position; list your controller under Pause In Photo Mode so the two do not fight. In a third-person game, set Handheld Viewpoint to a transform at the character's eyes and the handheld camera looks from there.
For a camera the player never holds (a security camera, a drone, a finish-line photo):
PhotoShoot.Take(securityCamera, profile, PhotoSource.Script);
Your own input #
Switch Built In Input off in the profile's Keys and call the camera yourself:
photoCamera.ToggleHandheld(); // or OpenHandheld(), OpenPhotoMode(), Close()
photoCamera.TakePhoto();
photoCamera.Zoom = 0.5f; // 0 is the widest view, 1 the closest
To keep the built-in screens' navigation but feed it from your own input system, write an IPhotoInput and hand
it over with PhotoInput.Use(myInput).
Your own UI #
Switch the built-in screens off (all, or only the ones you replace) and draw from the events and data:
photoCamera.ShotReady += shot =>
{
scoreLabel.text = shot.Photo.judged ? Mathf.RoundToInt(shot.Photo.score).ToString() : "";
preview.texture = shot.Texture;
};
The album and journal are plain data (PhotoAlbum.Main.Photos, PhotoJournal.Main.Entries). Mix and match: keep the
built-in viewfinder and result card, and show the album in your own menu.
Your own rule for what is kept #
photoCamera.DecideKeep = shot => shot.Photo.Shows("ghost"); // true keeps, false discards, null lets the profile decide
Your own data on photos #
Stamp every photo with values from your game and use them in rules (Data Equals) and your own UI:
photoCamera.SetStamp("weather", "storm");
photoCamera.SetStamp("chapter", "3");
Subjects carry their own values the same way (the Data list on a Photo Subject, or SetData).
Saving #
- Photos are files; the album looks after them. Use a different Storage Folder per save slot.
- The journal saves itself, joins a save product's slots when one is installed, or goes into your own saves with
ToJsonandFromJson. See Album and journal. - Players' options are remembered per device.
Pausing and time #
The handheld camera keeps the game running by default; the photo mode pauses it. Each can pause, slow or keep the world running (the World setting). The kit stacks its changes on top of whatever time scale your game had and puts it back exactly, so your own slow motion survives.
Working with other Rare Geometry products #
Each link switches on by itself when the other product is in the project, and does nothing when it is not. There is nothing to install and no setup.
| With | What you get |
|---|---|
| A map product (Bearing) | Tick Show On Maps on a Photo Subject and it appears on the compass, minimap and map: undiscovered until photographed, the objective while an open request asks for it. |
| A save product (Shipready) | The journal is part of the game's save slots. The players' shared accessibility choices (text size, reduced motion, high contrast, flash) apply to the camera screens. |
| An interaction product (Interactra) | Add Subject State Link to a photographable object with a Stable Id: its state (Open, Locked) becomes the subject's behaviour, so "photograph the gate while it is open" needs no code. |
Multiplayer #
Photos are local to each player: the camera, album and journal belong to the machine they run on. To share a result, send what you need from the photo record (subject, score) over your own network code.
Platforms #
Tested on Windows. Nothing in the kit is tied to a platform: it uses only Unity's own rendering, file and UI features. Saving a copy to the Pictures folder is offered on desktop only. On WebGL, where there are no threads, pictures are made on the main thread.