LDR input to Unity 3D Issues

I have been trying to use an LDR to input data into Unity 3D so I can trigger a random selection from voice clips in Unity but I'm not having much luck. I was following this video here but I think I am missing something as I can't get it to work the way I would like.
Basically I am trying to make it so that when the LDR reaches a certain level of darkness that in Unity it will call a function to play an audio clip from an array of random clips.
But I think I am missing something between what the code in his demo video uses VS the code I currently have.
If anyone more familiar with the Arduino Code and Unity can help that would be great.

Here is my Arduino code that I am using.

int lightPin = 0; //Define Pin For Photoresistor
int lightInt = 0;

const byte rLed = 12; //Sets Pin number LED is conneted too
const byte yLed = 11;
const byte gLed = 10;
const byte bLed = 9;
const byte bLed2 = 8;
char myChar;         //changed the name of this variable because they are not all colurs now
const byte pulsePins[] = {13, 7};  //pins for a pulse output
char pulseTriggers[] = {'p', 'q'};
const int NUMBER_OF_PULSE_PINS = sizeof(pulsePins);
unsigned long pulseStarts[NUMBER_OF_PULSE_PINS];
unsigned long pulseLength = 1000;

void setup()
{
  //Serial.begin (9600);
  Serial.begin (115200);
  pinMode(rLed, OUTPUT);
  pinMode(yLed, OUTPUT);
  pinMode(gLed, OUTPUT);
  pinMode(bLed, OUTPUT);
  pinMode(bLed2, OUTPUT);
  digitalWrite(rLed, LOW);
  digitalWrite(yLed, LOW);
  digitalWrite(gLed, LOW);
  digitalWrite(bLed, LOW);
  digitalWrite(bLed2, LOW);
  for (int p = 0; p < NUMBER_OF_PULSE_PINS; p++)
  {
    pinMode(pulsePins[p], OUTPUT);
    digitalWrite(pulsePins[p], LOW);
  }
}

void loop()
{ 
  if (Serial.available())              //if serial data is available
  {
    //Light Sensor
    if((lightInt - analogRead(lightPin)) > 10 || (lightInt - analogRead(lightPin)) < -10){
      lightInt = analogRead(lightPin);
      Serial.println(lightInt);
    }
    int lf = 10;

    myChar = Serial.read();             //read one character from serial
    if (myChar == 'r')                  //if it is an r
    {
      digitalWrite(rLed, !digitalRead(rLed));  //change the state of the r LED
    }
    if (myChar == 'b')
    {
      digitalWrite(bLed, !digitalRead(bLed));
    }

    if (myChar == 'y')
    {
      digitalWrite(yLed, !digitalRead(yLed));
    }

    if (myChar == 'g')
    {
      digitalWrite(gLed, !digitalRead(gLed));
    }

    if (myChar == '1')
    {
      digitalWrite(bLed2, !digitalRead(bLed2));
    }

    for (int p = 0; p < NUMBER_OF_PULSE_PINS; p++)
    {
      if (myChar == pulseTriggers[p])
      {
        pulseStarts[p] = millis();  //save the time of receipt
        digitalWrite(pulsePins[p], HIGH);
      }
    }
  }

  //the following code runs each time through loop()
  for (int p = 0; p < NUMBER_OF_PULSE_PINS; p++)
  {
    if (millis() - pulseStarts[p] >= pulseLength)  //has the pin been HIGH long enough ?
    {
      digitalWrite(pulsePins[p], LOW);   //take the pulse pin LOW
    }
  }
}

What DOES it do? Not doing what you want, is not very helpful.

Weedpharma

weedpharma:
What DOES it do? Not doing what you want, is not very helpful.

Weedpharma

Well in his video the LDR changes the ambient lighting in Unity's 3D environment, I just want the data to get a sound clip to play when the ambient light falling on the sensor is within a certain range.

I updated my original post to hopefully make it more clear as to the issue I'm having.

Turns out part of the problem was that I had the

//Light Sensor
    if((lightInt - analogRead(lightPin)) > 90 || (lightInt - analogRead(lightPin)) < -90){
      lightInt = analogRead(lightPin);
      Serial.println(lightInt);
    }

under this part of the code:

if (Serial.available())              //if serial data is available

Now the light sensor is working I just need to make my Unity 3D code not play the audio multiple and overlapping times. If I can get it to play only when the light value hits a certain level of darkness then it will be about perfect, then have it perhaps play from a different array of clips if it was say getting lighter outside (LDR reaches a certain level of brightness)
Not totally sure how to do that but that's what I want it to do.

I did a little video showing the effects of the voice overlaps if anyone knows how to stop that from happening?