Hello and apologizes regarding the title
I have no idea how to put this better.
My question is how to manage the following better:
I have 15 game objects instantiated randomly.
Each object when clicked, will direct you to a scene (15 scenes in total)
How to attach each load scene to each game object efficient when clicked ?
My code idea is this :
void SettingUpLocations()
{
if(Input.GetMouseButtonDown(0))
{
//SETUP EACH LOCATION
if (clickedGmObject.name == "BattleLocation1(Clone)")
{
Application.LoadLevel ("FirstLevel");
}
}
}
I will iterate this 14 more times. I am pretty sure there is a more effective way of doing this. Any ideas ?
BTW I also have a list of the spawned prefabs made like this :
prefabTransforms.Add(Instantiate(spawnThis*.transform, spawnPoints[r].transform.position , spawnPoints[r].transform.rotation) as Transform);*