Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

1 display no cameras rendering

Discussion in 'Scripting' started by Mspaintcreator, Jan 4, 2022.

  1. Mspaintcreator

    Mspaintcreator

    Joined:
    Feb 5, 2020
    Posts:
    1
    please help me i wanted to create cameras

    here is my code:

    Code (CSharp):
    1. public class UIController : MonoBehaviour
    2. {
    3.     public GameObject Tablet;
    4.     public GameObject[] Cameras;
    5.     public GameObject Camera;
    6.     private int currentIndex = 0;
    7.    
    8.  
    9.     public void TabletChangeVisible()
    10.     {
    11.         if (Tablet.activeSelf)
    12.         {
    13.             Tablet.SetActive(false);
    14.             Cameras[currentIndex].SetActive(false);
    15.             Camera.SetActive(true);
    16.         }
    17.         else
    18.         {
    19.             Tablet.SetActive(true);
    20.             Camera.SetActive(false);
    21.             Cameras[currentIndex].SetActive(true);
    22.         }
    23.         void changeCamera(int index)
    24.         {
    25.             Cameras[currentIndex].SetActive(false);
    26.             currentIndex = index;
    27.             Cameras[currentIndex].SetActive(true);
    28.         }
    29.     }
    30.     // Start is called before the first frame update
    31.     void Start()
    32.     {
    33.        
    34.     }
    35.  
    36.     // Update is called once per frame
    37.     void Update()
    38.     {
    39.        
    40.     }
    41. }
    that i can switch on ui buttons
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,082
    You posted this on the Meta-forum which as you can see is described as a place to discuss forum improvements. not cameras and rendering.

    Ignoring that, you don't describe what the actual problem is or how you'd like others to help.

    I'll move your post to the scripting sub-forum.