Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

How to add a audio source to a second FPS dual glock gun?

Discussion in 'Scripting' started by bosspappi, Oct 30, 2021.

  1. bosspappi

    bosspappi

    Joined:
    Jan 1, 2021
    Posts:
    8
    So I am currently on trying to give the second gun on the left a audio source gun firing sound effect when it fires, there is a gun sound effect on the first glock and it fires when I press the left mouse button.

    Is it best to make the gunshot sound effect in the animation Add Event, or can I do this in the C# script, and add a second audio source, and make the gunshot delay for like 0.40 seconds, because the second glock fires 0.40 seconds later than the glock on the right. So ill add another public AudioSource pistolShot; in line 13, but make another pistol shot sound and call it pistol shot 2?

    Then write pistolShot2.Play(); in line 29? I am just guessing.
    I made this video for you to see what I am trying to do
     

    Attached Files:

    • 2.png
      2.png
      File size:
      114.9 KB
      Views:
      220
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,780
    What are you waiting for? Sounds good, give it a try! Try all the things! This is software!
     
  3. bosspappi

    bosspappi

    Joined:
    Jan 1, 2021
    Posts:
    8
    ok thanks, do you want to team up to learn unity, and blender?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,780
    No thank you, but I urge you to keep after it, either on your own or with others online.

    If you want moar Blender3D and Unity3D (an INCREDIBLY powerful combination), check out Imphenzia on Youtube and join his discord channel. Lotsa good people and good fun going on there.

    ALSO: I urge you to just do random tutorials for Unity, because you will be amazed at all the odd tidbits of knowledge you will pick up along the way.

    Finally, let me leave you with a small treasure trove of interesting Blender3D and Unity3D knowledge:

    Blender3D import FBX:

    https://forum.unity.com/threads/from-blender-to-unity-problem.1073381/#post-6925811

    The script that Unity uses:

    ./Hub/Editor/2020.2.1f1/Unity.app/Contents/Tools/Unity-BlenderToFBX.py


    More on fixing it:

    https://forum.unity.com/threads/all-my-mesh-folder-content-is-gone.1102144/#post-7094962

    Blender3D objects used as trees / detail in Unity3D terrain (See the second half of this response)

    https://forum.unity.com/threads/ter...trees-made-with-blender.1112119/#post-7155631

    https://forum.unity.com/threads/all...nging-parent-in-blender.1159283/#post-7442123
     
  5. bosspappi

    bosspappi

    Joined:
    Jan 1, 2021
    Posts:
    8
    Thanks Kurt.
    You probably will never need this, but its a list of everything I ever learned in Unity 3D. Blender 3D, Make Human, Mixamo, C# Visual Scripting, and Bolt Visual Scripting, but the list will grow over time with knowledge, and ill add all the good websites that have good free props like in the Unity Asset Store. https://www.quora.com/Can-you-make-a-video-game-by-yourself/answer/Nicholas-Xee everything I ever learned is in this Quora link, from making trees, walls, the code to make a enemy follow the player, code to make an object disappear when the player goes to it. Hope it helps. Also Its a list to help people online to make games quickly, and it will save you months of time.
    Share it with others also.
     
    Kurt-Dekker likes this.