unknown identifier

I don’t know why but unity said that the identifier oriColor is a unknown identifier. However, I think I have defined it in the beginning part so what should i do to change it? This is a code for my enemy in the first person shooting game that I need to make as a project.

var hitSound:AudioClip;
var explosionSound:AudioClip;
var explosion:GameObject;
static var enemyMaxHP : float=100;
static var enemyHP:float;

function Start () {
    oriColor = renderer.material.color;
    enemyHP = enemyMaxHP;
}

function Update () {
    if (enemyHP <=0) {
        enemyHP=0;
        destroy();
    }
}

function damage(amount:int) {
    renderer.material.color = Color.red;
    audio.pitch = 0.9 + 0.1*Random.value;
    audio.PlayOneShot(hitSound);
    enemyHP-= amount;
    yield WaitForSeconds (0.1);
    renderer.material.color = oriColor;
}

function destroy () {
    audio.PlayOneShot(explosionSound);
    Instantiate(explosion, transform.parent.transform.position, 
    Quaternion.identity);
    Destroy(transform.parent.gameObject);
}

var hitSound:AudioClip; var

explosionSound:AudioClip; var

explosion:GameObject; static var

enemyMaxHP : float=100; static var

enemyHP:float;

You don’t have “oriColor” defined in your code…

I’ve further formatted to code to make it readable and moved the help/begging.

The error is 100% correct. You are trying to set a variable in the Start function that hasn’t be declared.

function Start () {
    oriColor = renderer.material.color; // <-- oriColor isn't a declared variable, hell you don't even use it whatsoever in the script
    enemyHP = enemyMaxHP;
}

The variable doesn’t look like it’s used, if it is meant to be accessable in the scope of the script, then add this to the top;

var oriColor : Color;