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. Dismiss Notice

Question Changing quality in-game C#

Discussion in 'Scripting' started by tsapapolis, Jan 25, 2021.

  1. tsapapolis

    tsapapolis

    Joined:
    Nov 27, 2020
    Posts:
    3
    Hi i'm making a 3d main menu for my game, with 3d text, camera rotation etc. and i dunno how to change graphics, resolution and fullscreen. Now it's only changing game object on click.
    Menu.gif
    Graphics
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Graphics : MonoBehaviour
    6. {
    7.     public GameObject Ultra;
    8.     public GameObject VeryHigh;
    9.     public GameObject High;
    10.     public GameObject Medium;
    11.     public GameObject Low;
    12.     public GameObject VeryLow;
    13.  
    14.     // Start is called before the first frame update
    15.     void Start()
    16.     {
    17.         Ultra.SetActive(true);
    18.     }
    19.  
    20.     // Update is called once per frame
    21.     void Update()
    22.     {
    23.         if (Ultra.GetComponent<Ultra>().Ultrabool == true)
    24.         {
    25.             Ultra.SetActive(false);
    26.             VeryLow.SetActive(true);
    27.         }
    28.         if (VeryHigh.GetComponent<VeryHigh>().VeryHighbool == true)
    29.         {
    30.             VeryHigh.SetActive(false);
    31.             Ultra.SetActive(true);
    32.         }
    33.         if (High.GetComponent<High>().Highbool == true)
    34.         {
    35.             High.SetActive(false);
    36.             VeryHigh.SetActive(true);
    37.         }
    38.         if (Medium.GetComponent<Medium>().Mediumbool == true)
    39.         {
    40.             Medium.SetActive(false);
    41.             High.SetActive(true);
    42.         }
    43.         if (Low.GetComponent<Low>().Lowbool == true)
    44.         {
    45.             Low.SetActive(false);
    46.             Medium.SetActive(true);
    47.         }
    48.         if (VeryLow.GetComponent<VeryLow>().VeryLowbool == true)
    49.         {
    50.             VeryLow.SetActive(false);
    51.             Low.SetActive(true);
    52.         }
    53.     }
    54. }
    55.  
    Resolution
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Resolution : MonoBehaviour
    6. {
    7.     public GameObject HighRes;
    8.     public GameObject MidRes;
    9.     public GameObject LowRes;
    10.  
    11.     // Start is called before the first frame update
    12.     void Start()
    13.     {
    14.         HighRes.SetActive(true);
    15.     }
    16.  
    17.     // Update is called once per frame
    18.     void Update()
    19.     {
    20.         if (HighRes.GetComponent<HighRes>().HighResbool == true)
    21.         {
    22.             HighRes.SetActive(false);
    23.             LowRes.SetActive(true);
    24.         }
    25.         if (MidRes.GetComponent<MidRes>().MidResbool == true)
    26.         {
    27.             MidRes.SetActive(false);
    28.             HighRes.SetActive(true);
    29.         }
    30.         if (LowRes.GetComponent<LowRes>().LowResbool == true)
    31.         {
    32.             LowRes.SetActive(false);
    33.             MidRes.SetActive(true);
    34.         }
    35.     }
    36. }
    37.  
    fullscreen
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Fullscreen : MonoBehaviour
    6. {
    7.     public GameObject Yes;
    8.     public GameObject No;
    9.  
    10.     // Start is called before the first frame update
    11.     void Start()
    12.     {
    13.         Yes.SetActive(true);
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update()
    18.     {
    19.         if (Yes.GetComponent<yes>().yesbool == true)
    20.         {
    21.             Yes.SetActive(false);
    22.             No.SetActive(true);
    23.         }
    24.         if (No.GetComponent<no>().nobool == true)
    25.         {
    26.             No.SetActive(false);
    27.             Yes.SetActive(true);
    28.         }
    29.     }
    30. }
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,833
  3. tsapapolis

    tsapapolis

    Joined:
    Nov 27, 2020
    Posts:
    3