I have written the script for instantiating an object as:
IEnumerator SpwanCubes()
{
while (true)
{
cube=Instantiate (cube, position, rotation) as GameObject;
cube.tag = id;
yield return new WaitForSeconds (spawnrate);
}
}
But
This happens when the objects are instantiated
Can somebody tell me a correct way to instantiate this object in such a way that I can assign a unique tag to the instantiated objects?