I have made a working script for a jumpscare, its attached to a cube for the moment. The script makes the cube appear when the player enters the trigger(the cube has a ghost image for now). But it’s a quick scare so the ghost can’t stay there for ever, so I also included some lines to destroy the cube after some seconds. My 2 problems are:
The object gets destroyed after some seconds after the game starts, so the countdown it’s not starting when the player enters the trigger, i need that first the object appear, then half of a second and then gets destroyed.
It doesn’t matter if I write 10, or 2.0, or 1.0 seconds, the object gets destroyed way to slow and the time doesn’t change, even if I type different numbers, and the cube can’t stay so long to make the jumpscare effective.
Here is the script, it’s simple but it works so far, the only problem are those two things, please help:
var Seconds = 1.0;
gameobject.renderer.enabled = false;
gameobject.renderer.enabled = true;