public void okayPressed()
        {
            GameObject laserSettingMenu = GameObject.Find("CameraVan LaserScanner Menu");
            Transform menuPanel = laserSettingMenu.transform.Find("Panel");

            if (!menuPanel.Find("ToggleIsActive").GetComponent<Toggle>().isOn)
            {
                gameObject.SetActive(false);
                return;
            }

            laserScanner = new LaserSetting();
            laserScanner.frameRate = int.Parse(menuPanel.Find("IFframeRate").GetComponent<InputField>().text);
            laserScanner.minDistance = float.Parse(menuPanel.Find("IFminDistance").GetComponent<InputField>().text);
            laserScanner.maxDistance = float.Parse(menuPanel.Find("IFmaxDistance").GetComponent<InputField>().text);
            laserScanner.verticalFOV = float.Parse(menuPanel.Find("IFverticalFOV").GetComponent<InputField>().text);
            laserScanner.horizontalFOV = float.Parse(menuPanel.Find("IFhorizontalFOV").GetComponent<InputField>().text);

            laserScanner.position = new Vector3();
            laserScanner.position.x = float.Parse(menuPanel.Find("IFposX").GetComponent<InputField>().text);
            laserScanner.position.y = float.Parse(menuPanel.Find("IFposY").GetComponent<InputField>().text);
            laserScanner.position.z = float.Parse(menuPanel.Find("IFposZ").GetComponent<InputField>().text);

            laserScanner.rotation = new Vector3();
            laserScanner.rotation.x = -float.Parse(menuPanel.Find("IFpitch").GetComponent<InputField>().text);
            laserScanner.rotation.y = -float.Parse(menuPanel.Find("IFyaw").GetComponent<InputField>().text);
            laserScanner.rotation.z = -float.Parse(menuPanel.Find("IFroll").GetComponent<InputField>().text);

            laserScanner.verticalResolution = float.Parse(menuPanel.Find("IFverticalResolution").GetComponent<InputField>().text);
            laserScanner.horizontalResolution = float.Parse(menuPanel.Find("IFhorizontalResolution").GetComponent<InputField>().text);

            GameObject.Find("CameraVanEdit").GetComponent<CameraVanEdit>().laserScanner = laserScanner;
            GameObject.Find("CameraVan LaserScanner Menu").gameObject.SetActive(false);
        }
        public void fillMenu()
        {
            CameraVanEdit cve = GameObject.Find("Canvas").transform.Find("CameraVanEdit").GetComponent<CameraVanEdit>();
            if (cve.laserScanner.frameRate < 1)
                return;

            laserScanner = cve.laserScanner;
            Transform menuPanel = gameObject.transform.Find("Panel");

            menuPanel.Find("IFframeRate").GetComponent<InputField>().text = laserScanner.frameRate.ToString();
            menuPanel.Find("IFminDistance").GetComponent<InputField>().text = laserScanner.minDistance.ToString();
            menuPanel.Find("IFmaxDistance").GetComponent<InputField>().text = laserScanner.maxDistance.ToString();
            menuPanel.Find("IFverticalFOV").GetComponent<InputField>().text = laserScanner.verticalFOV.ToString();
            menuPanel.Find("IFhorizontalFOV").GetComponent<InputField>().text = laserScanner.horizontalFOV.ToString();

            menuPanel.Find("IFposX").GetComponent<InputField>().text = laserScanner.position.x.ToString();
            menuPanel.Find("IFposY").GetComponent<InputField>().text = laserScanner.position.y.ToString();
            menuPanel.Find("IFposZ").GetComponent<InputField>().text = laserScanner.position.z.ToString();

            menuPanel.Find("IFpitch").GetComponent<InputField>().text = laserScanner.rotation.x.ToString();
            menuPanel.Find("IFyaw").GetComponent<InputField>().text = laserScanner.rotation.y.ToString();
            menuPanel.Find("IFroll").GetComponent<InputField>().text = laserScanner.rotation.z.ToString();

            menuPanel.Find("IFverticalResolution").GetComponent<InputField>().text = laserScanner.verticalResolution.ToString();
            menuPanel.Find("IFhorizontalResolution").GetComponent<InputField>().text = laserScanner.horizontalResolution.ToString();
        }
        public LaserSetting convertBackToLaser(SaveLaserSetting saveLaser)
        {
            LaserSetting ls = new LaserSetting();
            ls.minDistance = saveLaser.minDistance;
            ls.maxDistance = saveLaser.maxDistance;
            ls.horizontalFOV = saveLaser.FOVhorizontal;
            ls.verticalFOV = saveLaser.FOVvertical;
            ls.verticalResolution = saveLaser.resVertical;
            ls.horizontalResolution = saveLaser.resHorizontal;
            ls.position = saveLaser.position;
            ls.rotation = saveLaser.rotation;
            ls.frameRate = saveLaser.frameRate;

            return ls;
        }
        public SaveLaserSetting convertToSaveLaser(LaserSetting laserSetting)
        {
            SaveLaserSetting sls = new SaveLaserSetting();
            sls.FOVhorizontal = laserSetting.horizontalFOV;
            sls.FOVvertical = laserSetting.verticalFOV;
            sls.resHorizontal = laserSetting.horizontalResolution;
            sls.resVertical = laserSetting.verticalResolution;
            sls.position = laserSetting.position;
            sls.rotation = laserSetting.rotation;
            sls.minDistance = laserSetting.minDistance;
            sls.maxDistance = laserSetting.maxDistance;
            sls.frameRate = laserSetting.frameRate;

            return sls;
        }