I'm trying to make a horror game, so I looked for a tutorial on jumpscares. The script in the tutorial I found, worked in the video, but it doesnt work for me. What I want it to do is, when I walk into a box, I want an object to pop up with a screaming noise, but when I do it, the plane I am using with a face on it shows up, but without the face. here is the script...
Well there could be a few reasons. 1. Does the picture get affected by lighting? I'd assume the room or game in general is quite dark. 2. Is it possible that the plane is backwards, or that the texture/picture rendering is off? 3. Try to give it a constant "on" for one try, with a lit setting, to see if it's a rendering issue.
It just started giving me an error message saying "Assets/scripts/trigger.js(49,1): BCE0044: expecting }, found ''." And I tested it without the script to see if the plane would show up with the picture, and it did.
Code (JavaScript): var face : GameObject; var hasplayed = false; var entertrigger = false; var screamingsound : AudioClip; function Start () { entertrigger = false; face.renderer.enabled = false; } function OnTriggerEnter (other : Collider) { entertrigger = true; } function Update () { if (entertrigger == true) { face.renderer.enabled = true; removeovertime (); makehimscream (); } } function removeovertime () { yield WaitForSeconds (0.1); face.renderer.enabled = false; } function makehimscream () { if (!hasplayed) { hasplayed = true; audio.PlayOneShot(screamingsound); } There's the code
I fixxed the error message by adding another bracket at the very end, but it still isn't doing what I want.