I was wondering if I could change displays in Unity by hitting a key.

For example,

  • I want to look down on the battle, so I hit 1.

  • Then I want to see it from the side. I hit 2, etc.

Is that possible to do within Unity, or do I have to do that with a script?

I have 3 cameras set up, each of them outputting to a different display. I want to switch between those cameras/displays to get a different viewing angle for the players. As an example, in the Unity editor, in the upper left corner, you have a tab that says Display 1. Clicking that will show you other displays.

Also, when setting up a camera, you have to connect it to a display. (I know you already know this, I just wanted to make sure you guys knew what I was talking about

  • \$\begingroup\$ Are your asking about changing the camera angle? What do you imagine would render that impossible? How have you tried writing a script so far that listens for buttons to be pressed and repositions the camera in response? \$\endgroup\$ – DMGregory Aug 24 '19 at 11:40
  • \$\begingroup\$ Presumably you tried using a script to set the targetDisplay field of the camera in question? What did you try so far, and how did the results differ from what you want? \$\endgroup\$ – DMGregory Aug 24 '19 at 14:59
  • \$\begingroup\$ You can do that with the unity addon, "cinemachine" I believe it is now built in with Unity, but if you can't find it, it's free on the asset store. \$\endgroup\$ – Millard Aug 25 '19 at 1:05

in unity we have scenes. you have to implement you game in different scenes and change scenes using code below: using UnityEngine; using UnityEngine.SceneManagement;

public class ExampleClass : MonoBehaviour
    void Start()
        // Only specifying the sceneName or sceneBuildIndex will load the Scene with the Single mode
        SceneManager.LoadScene("OtherSceneName", LoadSceneMode.Additive);

scenes are files in assets. look at this link https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html

another approach to puth some gameObjects in a scene.then make camera show those scenes. this is my example:

list objList;


    Camera.main.transform.position= new Vector3(objList[0].transform.position.x,

|improve this answer|||||
  • \$\begingroup\$ It sounds like this could be done with one scene, just moving the camera, or reconfiguring objects in a single scene. \$\endgroup\$ – DMGregory Aug 24 '19 at 11:41
  • \$\begingroup\$ @DMGregory there is lots of possiblities but this is the simplest approach for a beginner \$\endgroup\$ – virtouso Aug 24 '19 at 11:45
  • 1
    \$\begingroup\$ I strongly disagree with that statement. At minimum, now we have to set up two scenes instead of just one And persisting game state across scenes is an issue that trips up many Unity beginners. So I would say this proposal is very much not simpler than the alternatives. \$\endgroup\$ – DMGregory Aug 24 '19 at 11:48
  • \$\begingroup\$ @DMGregory ill edit the answer \$\endgroup\$ – virtouso Aug 24 '19 at 11:53
  • \$\begingroup\$ I edited the question to include a few more details, I will add more if asked. @DMGregory \$\endgroup\$ – jackson Aug 24 '19 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.