- Home /
This question was
closed May 25, 2019 at 04:53 AM by
unity_21erushbrook for the following reason:
The question is answered, right answer was accepted
Question by
unity_21erushbrook · Apr 07, 2018 at 06:15 AM ·
scripting problemcodepage
Issues with Update and script. Why is it not repeating?
my code doesnt work. its super annoying. whenever i hold down the left arrow key, it rotates once. the same as if i click it.. why isnt it rotating once per frame for as long as im holding down the left arrow key? also just a side note it keeps rotating in intervals of 1 if I spam left arrow.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotate : MonoBehaviour {
public int angle;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown("left"))
{
transform.Rotate(Vector3.forward * 100 * Time.deltaTime);
}
}
}
Comment
Best Answer
Answer by Priyanka-Rajwanshi · Apr 07, 2018 at 06:35 AM
GetKeyDown works like a click. You need to use GetKey
Follow this Question
Related Questions
Need help <3 1 Answer
Need to increase the gameobject value . 2 Answers
change the source image in update function? help? 1 Answer
Child not accepting variables from the parent 0 Answers
Help with making script efficient 3 Answers