instatiating an object from another object and automatically tagging it to be collected

Hi all,

what i need is to make an object (3d model) like a machine in a factory instantiate another object (3dmodel) like a product and of course to collect it like the famous item collection game , it has to be tagged.

Does anyone know how to do that?

Perhaps a script will be helpful...................

Okay here is what i found after some research for the timer to be added so that the machine will produce a chocolate every 10 seconds

var myTimer : float=10.0; var chocolate:Transform;

function update () {

if(myTimer>0){ myTimer-=Time.deltaTime;

}

if(myTimer<=0) {

var instatiated = Instantiate(chocolate, transform.Find("Machine").transform.position, Quaternion.identity);

insantiated.tag = chocolate;

    ////////////////////////////////////////////////////
////Shall i add here  ------------myTimer=10.0; again
///////////////////////////////////////////////////

}

}

I would really appreciate if someone answers me

I believe you need to do this: code//

var WhatEverYouWantHere : Transform;

function update () { //call what you want to happen to cause the instantiate if(whatever) { var instatiated = Instantiate(WhatEverYouWantHere, transform.Find("the thing you want it made at").transform.position, Quaternion.identity); insantiated.tag = collectable; } }

that should probably do it...I hope.

I'm pretty sure that you don't have to add the timer there again since you already called the function and everything good job doing some research on your own and not sitting around and waiting for the answer which some people do, do.

EDIT:

actually looking at your comment again yes you do or else it's going to keep subtracting and not stop, oh and also, ten seconds seems a little long to wait for an Instantiate.

K.N.