I tried many scripts to make this work but i can’t find anything that i want.
I am making a scary game and what i want is when the fps collides through a invisible and untoucheble cube, a animation has to start and it has to make a creepy sound (only 1 time).
The animation is called: Ghost 1
The sound effect is called: Woman_Scream
I hope someone can help me, thanks
Actually it is fairly easy, and just to elaborate on what whydoidoit said:
- Fist make a box of any size
- Tick the “Is Trigger” box in the Inspector
- Name it ScreamTriggerWall (fits the upcoming code)
- Not add a script (in this case it’s a C#-script)
- Add the script to your FPS
- Add the following code
void OnTriggerEnter(Collider col)
* If the name of the object is "ScreamTriggerWall"
* - Then play a screaming sound
* NOTE: Figure out how to do that...
if(col.name == "ScreamTriggerWall")
// play sound now