Hello, I have used a script from here: (change or replace objects - Questions & Answers - Unity Discussions)
to replace an Gameobject with another GameObject, this is what I need to begin with but I would like to know how to ‘cycle’ through a series of objects and loop around back to the first object.
For an example I have a room and when clicking on furniture in the room (using a First Person Controller) the furniture will change from ‘chair’ to ‘stool’ to ‘sofa’ etc.
Could anyone help to edit or add to the script to achieve this?
Here is the script I have been using:
var object2 : GameObject;
var object3 : GameObject;
function OnMouseDown ()
{
Instantiate(object3,object.transform.position,object2.transform.rotation);
Destroy(object2);
}
Any help would be greatly appreciated, I have a good knowledge of Unity but less on scripting from scratch.
Thank you, Regards,
Christian