Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

How to have 2 main cameras in one screen

Discussion in 'Scripting' started by subzer0, Mar 24, 2016.

  1. subzer0

    subzer0

    Joined:
    Dec 10, 2010
    Posts:
    92
    Hello,

    I don't know if I asked the question in the title in the right way, but here is what I am doing.

    I want to make a game like the upcoming game for Nintendo Wii U called Star Fox Guard.

    This game is a tower defense game, where you have several security cameras which are found around the tower and whenever an enemy approaches, you should switch to the nearest camera and shoot him.

    Here is a short gameplay video:


    Here is a screenshot of what I achieved till now:


    Now what I want to do is that whenever I click one of the number buttons, the middle screen should switch to another camera. And through this middle screen, I want to shoot at the enemies, exactly like in the gameplay footage above.

    How can I achieve this ?

    Thanks.
     
  2. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,510
    Easiest method would be to have your Main Camera be the one in the middle and clicking on the button puts the Main Camera at the same position/rotation as the camera associated with the button you clicked.
     
  3. subzer0

    subzer0

    Joined:
    Dec 10, 2010
    Posts:
    92
    @KelsoMRK What I did is that I added a UI Raw Image in the middle and let its Texture be the Render texture of one of the cams.
    Now I think I don't have a problem switching the middle screen when clicking one of the buttons.
    But the problem is that how can I, for example, shoot from within this middle camera ?
    Thanks.
     
  4. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,510
    That's why just moving a Main Camera around would be easier :)
     
unityunity