private void Start() { if (functionsDropdown == null) { throw new MissingReferenceException($"{nameof(functionsDropdown)} isn't set on GraphFunctionSelector component."); } _graph = GetComponent <Graph>(); functionsDropdown.options = DropdownUtility.GetOptionsForEnum <EGraphFunctionName>(); functionsDropdown.value = (int)_graph.functionName; functionsDropdown.onValueChanged.AddListener(SetGraphFunction); }
private void Start() { _camerasRenderPipelineManager = new CamerasRenderPipelineManager(); _defaultToggleTextColor = masterIsActiveToggle.GetComponentInChildren <Text>().color; cameraRenderPresetDropdown.options = DropdownUtility.GetOptionsForEnum <ECamerasRenderPreset>(); _mapOfToggleToKeyCode = new Dictionary <Toggle, KeyCode> { { masterIsActiveToggle, KeyCode.Alpha1 }, { masterIsClearDepthToggle, KeyCode.Alpha2 }, { slaveIsActiveToggle, KeyCode.Alpha3 }, { slaveIsClearDepthToggle, KeyCode.Alpha4 } }; _mapOfToggleToText = new Dictionary <Toggle, Text>(); foreach (var toggle in _mapOfToggleToKeyCode.Keys) { var entry = new EventTrigger.Entry { eventID = EventTriggerType.PointerClick }; entry.callback.AddListener(data => { if (toggle.interactable == false) { return; } var keyCode = _mapOfToggleToKeyCode[toggle]; ToggleCameraRenderStateProperty(MapOfKeyCodeToCameraStatePropertyPath[keyCode]); }); toggle.gameObject.AddComponent <EventTrigger>().triggers = new List <EventTrigger.Entry> { entry }; _mapOfToggleToText[toggle] = toggle.GetComponentInChildren <Text>(); } UpdateCameras(); UpdateUI(); }