Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How to add camera to stack?

Discussion in 'Universal Render Pipeline' started by digipaul, Jul 6, 2020.

  1. digipaul

    digipaul

    Joined:
    Nov 24, 2018
    Posts:
    32
    How do you add a camera to a stack from script? According to unity docs you do the following:

    var cameraData = camera.GetUniversalAdditionalCameraData();
    cameraData.cameraStack.Add(myOverlayCamera);

    Yet this function doesn't seems to exist on the Camera class. Thanks.
     
  2. digipaul

    digipaul

    Joined:
    Nov 24, 2018
    Posts:
    32
    To answer my own question. You need to be using this using

    using UnityEngine.Rendering.Universal;
     
  3. Persegan

    Persegan

    Joined:
    Feb 12, 2015
    Posts:
    14
    That was useful for me! Thanks for the info ^^
     
  4. LateNighterDK

    LateNighterDK

    Joined:
    Oct 9, 2018
    Posts:
    4
    Exactly what I was searching for. Thanks for sharing.
     
  5. cooldude75

    cooldude75

    Joined:
    Apr 4, 2018
    Posts:
    2
    I have a same problem i want to get camera stack via script but issue is i have spawn cars with cameras.
    I want when car spawn in scene all the cameras with cars get the camera stack via script.
    what should i do.
     
    edin97 likes this.
  6. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    116

    It is not strictly necessary to use camera.GetUniversalAdditionalCameraData() extension method. The same can be achieved with the standard camera.GetComponent<UniversalAdditionalCameraData>().
     
    brainwipe likes this.