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

prevent rapid fire in space shooter

Discussion in 'Scripting' started by Boom Games Ltd., Nov 12, 2012.

  1. Boom Games Ltd.

    Boom Games Ltd.

    Joined:
    Oct 20, 2012
    Posts:
    5
    I have made a space shooter in unity3d but i dont want the rapid fire.I want only single fire.
    My fire code
    if (Input.GetKey("space"))
    {
    Instantiate(bullet,socket.position,socket.rotation);
    }
     
  2. Bladesfist

    Bladesfist

    Joined:
    Jan 3, 2012
    Posts:
    107
    use GetKeyUp or GetKeyDown.