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

Help! Simple If/Else statement

Discussion in 'Scripting' started by Jay2001, Dec 4, 2014.

  1. Jay2001

    Jay2001

    Joined:
    Dec 4, 2014
    Posts:
    19
    How would I have a code in C# that would act so that if I walk within a certain distance of something and press and hold the button(spacebar), then I would pick it up? and when I released the button, it would drop?
     
  2. Nubz

    Nubz

    Joined:
    Sep 22, 2012
    Posts:
    553
    Not as simple as an if/else but this video is pretty easy to follow I went through it about a week ago.
     
    KyleStank and Jay2001 like this.
  3. Jay2001

    Jay2001

    Joined:
    Dec 4, 2014
    Posts:
    19
    Thanks!