i’m working on 3D game, where the player needs to complete 4 play fields called “homes” in level 1, then progress to level 2 which has 4 homes of its own.
when complete the first home then come second home but problem was there third and fourth home not display??ByDefault Home1 is Active
public Camera cams;
Vector3 firsthome = new Vector3(17.6f, 19, 2.7f);
Vector3 secondhome = new Vector3(5.6f, 19f, 2.7f);
Vector3 thirdhome = new Vector3(-10, 19, 2.7f);
Vector3 fourthhome = new Vector3(-22, 19, 2.7f);
int managehome = 1;
//int[] managehome= { 2, 3, 4 };
void FixedUpdate()
{
switch(managehome)
{
case 1:
home2.SetActive(true); //home2 active
home1.SetActive(false);
home3.SetActive(false);
home4.SetActive(false);
cams.transform.position = secondhome; //camera move on home2
break;
case 2:
home3.SetActive(true); //home3 active
home2.SetActive(false);
home1.SetActive(false);
home4.SetActive(false);
cams.transform.position = thirdhome; //camera move on home3
break;
case 3:
home4.SetActive(true); //home4 active
home1.SetActive(false);
home2.SetActive(false);
home3.SetActive(false);
cams.transform.position = fourthhome; //camera move on home4
break;
default:
break;
}
}
Referance:
problem was when complete home 1 then come second home and when complete second home then not show home 3??