简体   繁体   中英

Unity 3d object to be shown after delay in the scene

I have just learnt Unity3D and figured out drawing objects and creating scenes. I could not make objects appear after delay. When the game starts I want objects appear after few seconds. I used waitforsec() but could not implement that. Is there a simple way to activate object after delay since start of the game?

Wait for 2 seconds then activate GameObject. You can change the 2 to any other number.

public GameObject gOBJ =null;

void Start()
{
 Invoke("showGameObject", 2);
}

void showGameObject()
{
 gOBJ.SetActive(true);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM