Welcome to SnapKit, a powerful and flexible Unity asset designed to detect objects within a camera's view and capture photos of them. This tool is perfect for creating photography gameplay mechanics, object recognition systems, or any feature that requires programmatic-in-game snapshots.
SnapKit's architecture is centered around three main components:
SnapKitManager
: The central hub that manages all SnapKitObject
instances and orchestrates the object detection process.SnapKitObject
: A component you attach to any GameObject you want to be detectable by the system.SnapKitPhotoCapture
: Handles the process of taking and saving photos when objects are detected.SnapKitManager
The SnapKitManager
is the singleton brain of the operation. It's responsible for keeping track of all SnapKitObject
s in the scene and determining which of them are visible to a given camera.
SnapKitManager.cs
script to this GameObject.SnapKitManager.Instance
.Property | Type | Description |
---|---|---|
Camera Range |
float |
The maximum distance from the camera that objects will be considered for detection. |
Layer Mask |
LayerMask |
The layers on which the detection raycasts will operate. Only objects on these layers will be considered. |
Enable Debug Logging |
bool |
If checked, detailed logs about the detection process will be printed to the console. |
Use Debug Camera |
bool |
(Editor Only) Enables the use of a specific debug camera for testing detection. |
Debug Cam |
Camera |
(Editor Only) The camera to use for debugging when Use Debug Camera is enabled. |
The SnapKitManager
's primary method is CaptureCamera(Camera cam)
. When called, it performs the following steps:
SnapKitObject
s within the specified _cameraRange
.