Model swapping Error

Hey Guys,

I’m trying to make a script to swap one model for another based on a timed sequence. It’s possible this script wouldn’t work at all but currently I am only getting one more for line 4,18 saying “Unexpected token: …”

var interval:float = 1; //For one second
var timer:float;
public var Model1.GameObject = Vincent;
public var Model2.GameObject = Vincent2;
private var currentModel.GameObject;

function Start () {
    timer = Time.time + interval; //The timer is equal to the time in the future
    currentModel = Instantiate(Model1, transform.position, transform.rotation) as GameObject;
}

function Update () {
    if (Time.time >= timer){
        Destroy(GameObject.currentModel);
        currentModel = Instatiate(Model2, transform.position, transform.rotation) as GameObject;
        yield WaitForSeconds (3);
        timer += interval;
        }
}

I’m not sure why it would give me an error only for that line when the other two below it are written in the same fashion.

Nevermind I fixed it by using a colon. I am getting the error for Vincent and Vincent 2 being an unknown Identifier. I have my character models named after these. Is there a different way to reference them?

Cancel that as well. I just removed the name at the end and it allowed me to attach the models but now I have the issue of the first Vincent model instantiating for every second. Is there a way to have it only happen once?

var interval:float = 1; //For one second
var timer:float;
public var Model1:GameObject;
public var Model2:GameObject;
private var currentModel:GameObject;

function Start () {
    timer = Time.time + interval; //The timer is equal to the time in the future
    currentModel = Instantiate(Model1, transform.position, transform.rotation) as GameObject;
}

function Update () {
    if (Time.time >= timer){
        Destroy(GameObject.currentModel);
        currentModel = Instantiate(Model2, transform.position, transform.rotation) as GameObject;
        yield WaitForSeconds (3);
        timer += interval;
        }
}