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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

I'm not sure why the 50 isnt working here

Discussion in 'Scripting' started by LivelyEngineer, Dec 15, 2018.

  1. LivelyEngineer

    LivelyEngineer

    Joined:
    Dec 15, 2018
    Posts:
    4
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Movement : MonoBehaviour {
    float Speed = 50;

    private void Start() {
    }
    void Update() {
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
    transform.position += Vector3.forward * Speed * Time.deltaTime;
    }
    }
    }

    How do I make it so it continuously moves if this key pressed instead having to spam the button
     
  2. LivelyEngineer

    LivelyEngineer

    Joined:
    Dec 15, 2018
    Posts:
    4
    lol sorry forgot to change the title xD
     
  3. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,900
    eses likes this.
  4. LivelyEngineer

    LivelyEngineer

    Joined:
    Dec 15, 2018
    Posts:
    4
  5. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,900
    You didn't "caused" anything, don't worry, but home work, read this document. ;) And just for the sake of practice, put your code in the first post into code tags, next time, you will do it automatically.

    And I hope my answer was helpful so you can fix your game too! Keep up the work!
     
  6. LivelyEngineer

    LivelyEngineer

    Joined:
    Dec 15, 2018
    Posts:
    4
    Thank you! And ye I'm working on a remake of Super Mario Galaxy but ye thank you again!
     
    Lurking-Ninja likes this.