// Start is called before the first frame update
    void Start()
    {
        commandDict.Add('a', SpawnTarget(0));
        commandDict.Add('b', SpawnTarget(1));
        commandDict.Add('c', SpawnTarget(2));
        commandDict.Add('d', SpawnTarget(3));
        commandDict.Add('e', SpawnTarget(4));
        commandDict.Add('f', SpawnTarget(5));
        commandDict.Add('g', SpawnTarget(6));
        commandDict.Add('h', SpawnTarget(7));

        photodiodeTarget = PhotodiodeTargetObject.GetComponent <PhotodiodeTarget>();

        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = CommonUtils.frameRate;

        // Retrieve a reference for the scripts, starting from the GameObjects of the scene
        targetScript = Target.GetComponentInChildren <VGOTarget>();

        serialPort = new SerialPort(pyControlPortName, 9600, 0, 8, StopBits.One);
        try
        {
            serialPort.Open();          // open the port
            serialPort.ReadTimeout = 1; //define the timeout
        }
        catch (IOException e)
        {
        }

        StartCoroutine(WaitForCommand());
    }
    void Start()
    {
        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = CommonUtils.frameRate;

        // Call all the functions to setup the environment
        SetupBackgroundColor();
        SetupIndicatorSize();
        SetupInterTrialTime();
        SetupCollisionTime();
        SetupTargetTimeout();
        SetupNumberOfTrials();
        SetupTargetSize();
        SetupAnimalName();
        SetupLickToReward();
        SetupWhiteNoise();
        SetupLaser();

        // Print the configuration, if needed
        PrintStartingConfiguration();

        // Retrieve a reference for the scripts, starting from the GameObjects of the scene
        sensorScript = Sensor.GetComponentInChildren <SensorScript>();
        targetScript = Target.GetComponentInChildren <VGOTarget>();

        // Init a new DataCollector
        dc = new DataCollector
        {
            taskName   = "Habituation",
            AnimalName = animalName
        };

        // Start a thread the waits for the user to start the experiment
        StartCoroutine(WaitForStart());
    }