private void Awake() { ///Finds the variables needed from the GameController variables = GameObject.FindGameObjectWithTag("GameController").GetComponent <ConsistentVariables>(); //Finds the correct dropdown component, uses a bool to see if its found it so it doesn't attempt to find it at the start of each scene change back if (dropdownFound == false) { dropdown = GetComponent <TMP_Dropdown>(); dropdownFound = true; } if (dropdown != null) { //Playback Engine Size Dropdown if (this.gameObject.name == "PlaybackEngineDropdown") { //sets the value of the dropdown to what is found in the consistent variables value dropdown.value = variables.playbackEngine; //sets the message to the correct text attached to the value message = dropdown.options[variables.playbackEngine].text; } //Buffer Size Dropdown if (this.gameObject.name == "BufferSizeDropdown") { dropdown.value = variables.bufferSize; message = dropdown.options[variables.bufferSize].text; } //Cache Size Dropdown if (this.gameObject.name == "CacheSizeDropdown") { dropdown.value = variables.cacheSize; message = dropdown.options[variables.cacheSize].text; } } }
private void Start() { objChild = gameObject.transform.GetChild(0); variables = GameObject.FindGameObjectWithTag("GameController").GetComponent <ConsistentVariables>(); }
private void Start() { ///Finds the variables needed from the GameController variables = GameObject.FindGameObjectWithTag("GameController").GetComponent <ConsistentVariables>(); }
private void Start() { variables = GameObject.FindGameObjectWithTag("GameController").GetComponent <ConsistentVariables>(); kremidifier = GameObject.FindGameObjectWithTag("GameController").GetComponent <Kremidifier>(); }
private void Start() { ///Finds the variables needed from the GameController variables = GameObject.FindGameObjectWithTag("GameController").GetComponent <ConsistentVariables>(); //Sets the starting location for instantiating corrections x_placement = -124; y_placement = 175; //Checks if the relevant variable is incorrect from what we want if (variables.resetSystem == false) { //Makes a temporary variable of the RectTransform of the relevant object (affects size, location and etc of the component we are using in the UI, since the buttons are a UI element a normal transform change doesn't work since it is tied to the camera) var m_RectTransform = noReset.GetComponent <RectTransform>(); //Sets the anchored position of the element, this sets the position in world space rather than in relation to its parent canvas m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); //Lowers the y position for the next correction to spawn y_placement = y_placement - 35; } //The same process is done for each but with the relevant prefab and variables in place, I'm not sure if there is a less code heavy way to do this (I bet someone will say an array or something) if (variables.switchesOrder == false) { var m_RectTransform = wrongOrder.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (variables.power == false) { var m_RectTransform = noMainPower.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (variables.deskPower == false) { var m_RectTransform = noDesk.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (variables.interfacePower == false) { var m_RectTransform = noInterface.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } //Checks if the placement has reached the bottom of the relevant area, if so it will reset the y coordinate and move the x coordinate over to the right somewhat if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.computerPower == false) { var m_RectTransform = noComputer.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.speakerPower == false) { var m_RectTransform = noSpeakers.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.playbackEngine != 4) { var m_RectTransform = wrongPlaybackEngine.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.bufferSize != variables.wantedBufferSize) { var m_RectTransform = wrongBufferSize.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.ignoreErrors != variables.wantedIgnoreErrors) { var m_RectTransform = wrongIgnoreErrors.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.dynamic != variables.wantedDynamicProcessing) { var m_RectTransform = wrongDynamicProcessing.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.videoEngine == true) { var m_RectTransform = wrongVideoEngine.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (y_placement == -35 && x_placement == -124) { y_placement = 175; x_placement = 120; } if (variables.cacheSize != 0) { var m_RectTransform = wrongCacheSize.GetComponent <RectTransform>(); m_RectTransform.anchoredPosition = new Vector2(x_placement, y_placement); y_placement = y_placement - 35; } if (x_placement == -124 && y_placement == 175) { textElement.text = nothingWasWrong; } }