Hi, this is my second question, I am currently creating my first horror game, but now I need help.
I don’t know how to make an enemy appear then disappear, in other words, I don’t know the script.
Please tell me how and if you do give a script please tell me the type.
Oh and also, if possible, can an audio be inserted with the character everytime it
Appears? Thank you. I will be sure to add you to the credits.
Here, just made this, tested and it works: [It’s javascript]
function OnTriggerEnter (other : Collider){
if (other.gameObject.tag == "Player") {
renderer.enabled = true;
yield WaitForSeconds(2);
renderer.enabled = false;
}
}
To use it, attach this to your enemy, and make sure you have a collider (a box collider works best) and check “Is Trigger.” When your player enters the box collider, the enemy will appear for 2 seconds and then disappear. You can change the time in WaitForSeconds(); to whatever you like.
You don’t need to add me to the credits