void CacheFormats(int deviceIndex)
        {
            var formats = DeviceEnumerator.GetOutputFormatNames(deviceIndex);

            _formatLabels = formats.Select((x) => new GUIContent(x)).ToArray();
            _formatValues = Enumerable.Range(0, formats.Length).ToArray();
        }
        void OnEnable()
        {
            _deviceSelection        = serializedObject.FindProperty("_deviceSelection");
            _queueLength            = serializedObject.FindProperty("_queueLength");
            _targetTexture          = serializedObject.FindProperty("_targetTexture");
            _targetRenderer         = serializedObject.FindProperty("_targetRenderer");
            _targetMaterialProperty = serializedObject.FindProperty("_targetMaterialProperty");

            // Scan all available devices.
            var devices = DeviceEnumerator.GetDeviceNames();

            _deviceLabels  = devices.Select((x) => new GUIContent(x)).ToArray();
            _deviceOptions = Enumerable.Range(0, devices.Length).ToArray();
        }
        void OnEnable()
        {
            _deviceSelection = serializedObject.FindProperty("_deviceSelection");
            _formatSelection = serializedObject.FindProperty("_formatSelection");
            _queueLength     = serializedObject.FindProperty("_queueLength");
            _lowLatencyMode  = serializedObject.FindProperty("_lowLatencyMode");
            _isMaster        = serializedObject.FindProperty("_isMaster");

            // Scan all available devices.
            var devices = DeviceEnumerator.GetDeviceNames();

            _deviceLabels = devices.Select((x) => new GUIContent(x)).ToArray();
            _deviceValues = Enumerable.Range(0, devices.Length).ToArray();

            CacheFormats(_deviceSelection.intValue);
        }