public void Begin()
        {
            if (Initialized)
            {
                return;
            }

            Initialized = true;

            if (!ReportingManager.IsTestWithoutRecordingFile && RecordedPlaybackPersistentData.GetRecordingMode() == RecordingMode.Playback && !File.Exists(RecordedPlaybackPersistentData.GetRecordingDataFilePath()))
            {
                logger.LogError($"Recorded Playback file does not exist.");
                return;
            }

            if (inputModule == null)
            {
                inputModule = gameObject.AddComponent <RecordingInputModule>();
            }
            if (RecordedPlaybackPersistentData.GetRecordingMode() == RecordingMode.Record)
            {
                gameObject.AddComponent <GameListenerHandler>();
            }
            SetEventSystem();
            VisualFxManager.SetUp(Instance.transform);
        }
        /// <summary>
        /// Check if an EventSystem already exists at the time of recording or playback start.
        /// If one exists, set our EventSystem variables to the values defined by the existing system.
        /// Finally, disable the pre-existing system. There can only be one active EventSystem.
        /// </summary>
        void SetEventSystem()
        {
            if (!Initialized)
            {
                return;
            }

            if (EventSystem.current != null)
            {
                GameObject inputObj = new List <GameObject>(FindObjectsOfType <GameObject>()).Find(x =>
                                                                                                   x != gameObject && x.GetComponent <BaseInputModule>() && x.GetComponent <EventSystem>());
                if (inputObj == null)
                {
                    logger.Log("No existing Event System & Input Module was found");
                    return;
                }

                RecordingInputModule  ourModule       = inputModule;
                StandaloneInputModule theirModule     = inputObj.GetComponent <StandaloneInputModule>();
                BaseInputModule       theirBaseModule = inputObj.GetComponent <BaseInputModule>();
                if (theirModule != null)
                {
                    ourModule.cancelButton          = theirModule.cancelButton;
                    ourModule.submitButton          = theirModule.submitButton;
                    ourModule.verticalAxis          = theirModule.verticalAxis;
                    ourModule.horizontalAxis        = theirModule.horizontalAxis;
                    ourModule.inputActionsPerSecond = theirModule.inputActionsPerSecond;
                    ourModule.repeatDelay           = theirModule.repeatDelay;
                }

                EventSystem ourEventSystem   = ourModule.GetComponent <EventSystem>();
                EventSystem theirEventSystem = inputObj.GetComponent <EventSystem>();
                ourEventSystem.firstSelectedGameObject = theirEventSystem.firstSelectedGameObject;
                ourEventSystem.sendNavigationEvents    = theirEventSystem.sendNavigationEvents;
                ourEventSystem.pixelDragThreshold      = theirEventSystem.pixelDragThreshold;

                theirBaseModule.enabled = theirEventSystem.enabled = false;
            }

            EventSystem.current = GetComponent <EventSystem>();
        }