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.


Core Components

SnapKit's architecture is centered around three main components:


SnapKitManager

The SnapKitManager is the singleton brain of the operation. It's responsible for keeping track of all SnapKitObjects in the scene and determining which of them are visible to a given camera.

Setup

  1. Create an empty GameObject in your scene and name it "SnapKitManager" (or similar).
  2. Attach the SnapKitManager.cs script to this GameObject.
  3. This manager will now be automatically accessible via SnapKitManager.Instance.

Properties

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:

  1. It identifies all registered SnapKitObjects within the specified _cameraRange.