• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by Peanut97 · Nov 07, 2012 at 11:14 PM · gameobject

Can somebody help me out with a jumpscare? (Like from the game "Slender")

I am fairly new to Unity3d and I need some help from the masters... :) I am creating a Slender game in Unity3d (for those of you who don't know what what Slender is, it's a first person survival horror game in w$$anonymous$$ch you are being chased by Slenderman, who is a tall man with no face.) In the game Slender, whenever you see Slenderman it makes a loud noise (jumpscare.) In my remake of t$$anonymous$$s game, I am trying to figure out how to create t$$anonymous$$s effect. How do I make it so whenever you look at Slenderman it makes a loud noise? (Slenderman is just a 3d model from the internet) I realize t$$anonymous$$s will require a script and I am just asking for some help with it. Thank you guys so much for helping me out with t$$anonymous$$s dilemma! I REALLY appreciate it!!

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GameCreat3r · Nov 07, 2012 at 11:26 PM 0
Share
avatar image GameCreat3r · Nov 08, 2012 at 11:14 PM 0
Share
avatar image sparkzbarca · Nov 09, 2012 at 12:38 AM 0
Share
avatar image AlucardJay · Nov 09, 2012 at 02:59 AM 0
Share
avatar image Peanut97 · Nov 09, 2012 at 03:17 AM 0
Share
Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sparkzbarca · Nov 08, 2012 at 01:13 AM

attach a sound o to slender man (component-->audio-->audio source)

raycast towards the front of the player if the object $$anonymous$$t is slenderman play the sound file

t$$anonymous$$s should be the script basically (its an easy script)

 //attach t$$anonymous$$s to the player object 
 //its in C#
 //i'm making alot of stuff drag and drop
 //so you can just drop in your stuff in the 
 //editor to make it work.
 
 
 using UnityEngine;
 using System.Collections;
 
 public class NewBehaviourScript : MonoBehaviour {
 
     public GameObject slenderman;
     RaycastHit raycast;
     
     void Update () {
     Physics.Raycast(transform.position,transform.forward, out raycast);
         if(raycast.transform.gameObject == slenderman)
         {
             slenderman.audio.Play();
         }
         
     }
 }

Now you take t$$anonymous$$s script w$$anonymous$$ch you created and after you build and run it in the script editor t$$anonymous$$ng. You go back into unity and click on the script. it will now have a variable you can change on the right called slenderman. You take your slenderman Prefab and you drag and drop that onto it so the script knows what slenderman is.

it will cast a ray in front of the player and if it is slenderman it will play the audio attached to slenderman.

That means you also need to attach an audio component to the slenderman.

Comment
Add comment · Show 14 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Peanut97 · Nov 08, 2012 at 02:05 AM 0
Share
avatar image sparkzbarca · Nov 08, 2012 at 02:17 AM 0
Share
avatar image GameCreat3r · Nov 08, 2012 at 03:20 AM 0
Share
avatar image sparkzbarca · Nov 08, 2012 at 03:43 AM 0
Share
avatar image GameCreat3r · Nov 08, 2012 at 03:52 AM 0
Share
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Unity Editor Function Animation 0 Answers

lighting script help 1 Answer

How to tell if 2 blocks are next to each other in a 2d game? 1 Answer

Not working gui buttons 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges