Dynamic Photo Camera: in-game photos
  • DYNAMIC PHOTO CAMERA DOCS 🔰
  • 📷 Unity Asset Store page
  • ▶️ Official YouTube playlist
  • 🤝 Discord support
  • ⚡ Extra Short Guide
  • DATA
    • Core Components
    • Setup and Modes
    • Usage Guide
    • Gamepad Support
    • Demo & Ideas
    • Additional
  • Help
    • Prompting & PDF
    • Common Issues
    • Contacts
Powered by GitBook
On this page
  • Textures, rendering, visuals
  • UI, canvas, interface elements
  • Input system
  • Demo scene
  • Object Recognition
  • Split Screen
  1. Help

Common Issues

PreviousPrompting & PDFNextContacts

Last updated 26 days ago

Textures, rendering, visuals

⛔ Problem: Photo does not display glow or other rendered camera effects, or renders nothing. Or error occurs: “RenderTexture.Create failed: colorFormat & depthStencilFormat cannot both be none”.

✅ Solution 1: Find Scripts → PhotoSettings scriptable object and select the texture format from the list, for example, DefaultHDR for the Glow effect.

✅ Solution 2 (through code): Open PhotoController.cs → MakeScrenshot(). Replace the following line:

targetTexture = RenderTexture.GetTemporary(photoSettings.resWidth, photoSettings.resHeight);

with:

targetTexture = RenderTexture.GetTemporary(photoSettings.resWidth, photoSettings.resHeight, 24, RenderTextureFormat.DefaultHDR);

UI, canvas, interface elements

⛔ Problem: Buttons/photos do not respond to input. PhotoController prefab contains its Canvas with UI elements, and existing ones may overlap them or vice versa.

✅ Solution: Unpack prefab and move UICanvas content to existing Canvas or vice versa.

Input system

⛔ Problem: If you use a new input system, an error may occur: “InvalidOperationException: You are trying to read Input using the UnityEngine…”.

✅ Solution: Set inputSystemType → New in the InputController component. Open Edit → Project Settings → Player → Configuration, and set Active Input Handling to "both". Install the InputSystem via Package Manager. Replace EventSystem → StandaloneInputModule with InputSystemUIInputModule.

Demo scene

⛔ Problem: Materials and textures in the test scene are not loading properly.

✅ Solution: All materials & textures for the example objects are stored in the Materials folder. The materials use the "Standard" shader by default. For URP projects, change the shader to "URP/Lit" or any appropriate shader compatible with your render pipeline.

Object Recognition

⛔ Problem: Camera struggles to detect objects accurately, especially when dealing with details or complex meshes.

✅ Solution 1 (recognize one more precisely): Increase the collider trigger of the desired object so that it does not overlap with another and is better recognized. Reduce the Sphere Radius value in the Photo Settings scriptable object. A smaller value results in a thinner ray, making object recognition more precise. Additionally, you can customize the behavior of the RaycastCheck method in the PhotoController.cs to better fit your specific requirements.

✅ Solution 2 (recognize one more precisely): Assign a special layer to interfering objects and disable it for recognition in Raycast Layers in PhotoSettings scriptable object. Or assign a special layer to recognizable object and disable all other layers for recognition.

✅ Solution 3 (recognize all and look for one among them): Use Multiple Objects mode in PhotoSettings, set larger Sphere Radius and multiplayerPrecision values ​​to accurately recognize each visible object. Check if the photo contains the desired object.

Split Screen

⛔ Problem: In a split-screen setup where each player has their own photo camera, the snapshot may only capture a quarter or half of the screen instead of a full image from a single camera.

✅ Solution: temporarily set the current camera's viewport to full screen (0,0,1,1) before taking the photo (maybe also temporarily disable all other cameras during the capture moment), then restore it afterward. Like this:

private void MakeScreenshot()
{
    // Create a render texture at the target photo resolution
    var targetTexture = RenderTexture.GetTemporary(
        photoSettings.resWidth,
        photoSettings.resHeight,
        24,
        photoSettings.renderTextureFormat);
   
    // Store the camera's original target and viewport rect
    var originalTarget = currentCamera.targetTexture;
    var originalRect = currentCamera.rect;
   
    // Set the camera to render to our texture
    currentCamera.targetTexture = targetTexture;
   
    // Important: For split-screen, we need to temporarily set the camera to render the full texture
    // This is the key fix - we set the camera to render to the entire texture
    currentCamera.rect = new Rect(0, 0, 1, 1);
   
    // Render the camera view to the texture
    currentCamera.Render();
   
    // Restore the camera's original settings
    currentCamera.targetTexture = originalTarget;
    currentCamera.rect = originalRect;
   
    // Continue with your existing code to process the rendered texture
    // ...
}

Or choose another texture format that suits your project. .

List of all possible formats
Both input systems support