How make spawn for horror game?

Hello!
Please help me .
I am making horror game , but i don’t know how make spawn .
I want make a trigger zone , and if i stay in , object spawning and over some time disappear.
Sorry i am speak littl english .

In advance thanks!

Be sure to post responses as comments, not answers, and accept answers that worked for you. I can't convert your answer (awaiting moderation at time of writing) to a comment because its too small.

1 Answer

1

Hey, so you should use the function OnTriggerStay(). Code would look something like

OnTriggerStay(collider: player)
{
if(player.gameObject.tag ==“spawn”)
{
Instantiate(enemy,position, rotation)
}

Seething like that, it’s pseudo code, but I hope it helps.