Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by Dave 7 · Oct 01, 2010 at 12:52 PM · audiofpsfootsteps

Footstep audio for FPS

Hi, I am currently trying to get a footsteps track to play while I move through a scene (FPS). I have seen a lot of scripts on the forums but I dont know how or where to place these - any help would be greatly appreciated as I have never done any kind of scripting, really need a step by step! Thanks Dave

Comment
Add comment · Show 1
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 Jesse Anders · Oct 01, 2010 at 02:49 PM 1
Share

I think you'll have better luck if you ask a more specific question. As you've found, there are plenty of examples of how to do this in the forums. If you're not having any luck with those examples, perhaps you could describe what you've tried and what sort of problems you've run into. (Also, I think this might be better suited as a forum thread rather than as a Unity Answers question.)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by skovacs1 · Oct 01, 2010 at 04:14 PM

This question is really quite general, but I'll try to be as specific as I can.

Going through the tutorials and checking out their setups is a great way to start. I recommend checking out the 2D platformer tutorial specifically as I know that it has sound on footfalls.

Their setup has the following:

  1. A script on each surface specifying a collision sound effect.
  2. A script on Foot Effects transforms in the hierarchy which have rigidbodies and colliders
  3. In the script on the Foot Effects, it checks for collision, looks for the sound effect on what it collided with and then plays it.

It is possible that your FPS doesn't actually have a player character but a camera floating in space. In this case, you would have to decide how and when to trigger your sounds.

To play audio, you can do something like:

audio.clip = collisionSoundEffect.audioClip;
audio.Play();

or

audio.PlayOneShot(collisionSoundEffect.audioClip);

You would do this whenever you move. You could do some boolean checking (as a lock) to prevent playing the sound too frequently, possibly with a coroutine to wait a specified amount of time or something to control the flag.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

FPS Footstep Audio Plays Too Quickly 1 Answer

How to add a footstep sound to rigidbody fps controller from standart assets (It has no animations)? 0 Answers

Switch Audio on Different surfaces 0 Answers

Varied footsteps - Object reference not set to an instance of an object? 2 Answers

music (2d audio) kills game framerate 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