• 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
Question by Ben Colus · Nov 25, 2010 at 05:10 AM · soundgunfpstutorial

Problems implementing sound for machine gun enemy:

I'm using the generic sentry gun as outlined in the FPS tutorial, and have had a frustrating problem implementing sound. The tutorial describes how to put the sound in for the machine gun weapon, but it doesn't describe such a method for the sentry, and none of the obvious approaches seem to work.

I've tried attaching sounds to every aspect of the sentry, the muzzle flash, the impact sparks, etc, but I can't get it to make any noise. I'm using the sentry for a "run for cover" sort of challenge, so sound is very important (the player needs to know when it's stopped firing).

This isn't just for fun, I need this for a "build a level in two weeks" test for a game design job. My future in the industry depends on getting this right, so any help would be appreciated!

Comment

People who like this

0 Show 0
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

2 Replies

  • Sort: 
avatar image

Answer by oliver-jones · Nov 25, 2010 at 06:29 AM

Okay doky, lets see what we can do here.

In your script, I'm assuming you will have a line of code that says:

// If we are almost rotated towards target - fire one clip of ammo
    var forward = transform.TransformDirection(Vector3.forward);
    var targetDir = target.position - transform.position;
    if (Vector3.Angle(forward, targetDir) < shootAngleDistance)

Simply add an:--> After the if statement

audio.Play();

What you want to do now is add an audio source to your turret, then drag your audio file into that source, and check play automatically OFF. Play the game and it should work, if not, Restart Unity. There is a bug in unity where the audio cuts out sometimes.

Comment

People who like this

0 Show 0 · 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

Answer by kkk · Dec 31, 2010 at 12:18 PM

Hi there i am looking for ww1 it says u will tell me about it. obviously not!

Comment

People who like this

0 Show 1 · 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 nowhereman · Dec 31, 2010 at 06:47 PM 0
Share

a)pick a better username, that one is offensive b)wth are you talking about? c)this is a community for people using Unity, a game developement program. Welcome. While some games may be about ww1, i would not recommend trying to learn about ww1 from any of the questions posted on here, as most, if not all, are about technical game issues, not subject matter such as ww1. if your reading is better than your spelling or grammar, i recommend you go to a library or find a website that is clearly about ww1

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Hello there!! So when i hold LMB its continuously makes the gun noise but i want it so that there a 2 second delay in between each gun sound, how do i do this?? 1 Answer

How to add sound to gun shot script 4 Answers

Machine gun sound — better to loop individual bullets or have a longer sample? 0 Answers

gun fire sound 2 Answers

hey here wesley again sound for my gun 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