使用unity编程,C#,出现The name `If' does not exist in the current context该如何修改?
脚本如下:publicvoidsetID(intID){If(setID()==1);{//Showonlymovie1moviePlane1.SetActive(tru...
脚本如下:
public void setID(int ID)
{
If (setID() == 1);
{
// Show only movie1
moviePlane1.SetActive (true);
movieTexture1.play (true);
moviePlane2.SetActive (false);
movieTexture2.pause ();
moviePlane3.SetActive (false);
movieTexture3.pause ();
}
If (setID () == 2);
{
// Show only movie2
moviePlane1.SetActive(false);
movieTexture1.pause();
moviePlane2.SetActive(true);
movieTexture2.play(true);
moviePlane3.SetActive(false);
movieTexture3.pause();
}
If (setID () == 3);
{
// Show only movie3
moviePlane1.SetActive(false);
movieTexture1.pause();
moviePlane2.SetActive(false);
movieTexture2.pause();
moviePlane3.SetActive(true);
movieTexture3.play(true);
}
}
几个IF语句的地方都出现了同样的问题,该如何修改呢? 展开
public void setID(int ID)
{
If (setID() == 1);
{
// Show only movie1
moviePlane1.SetActive (true);
movieTexture1.play (true);
moviePlane2.SetActive (false);
movieTexture2.pause ();
moviePlane3.SetActive (false);
movieTexture3.pause ();
}
If (setID () == 2);
{
// Show only movie2
moviePlane1.SetActive(false);
movieTexture1.pause();
moviePlane2.SetActive(true);
movieTexture2.play(true);
moviePlane3.SetActive(false);
movieTexture3.pause();
}
If (setID () == 3);
{
// Show only movie3
moviePlane1.SetActive(false);
movieTexture1.pause();
moviePlane2.SetActive(false);
movieTexture2.pause();
moviePlane3.SetActive(true);
movieTexture3.play(true);
}
}
几个IF语句的地方都出现了同样的问题,该如何修改呢? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询