jdog
1
My simple script for rotating an object won’t work. Please help me!
Screenshot below.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraLook : MonoBehaviour {
public float turnSpeed = 100f;
void update () {
if (Input.GetKey (KeyCode.E)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
if (Input.GetKey (KeyCode.Q)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
}}
You should use “Update” function, not update. :))
All it is you are using a lower case “u” like said in the first comment. it like on Void Start both Start and Update both need to have Caps to work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class roate : MonoBehaviour {
public float turnSpeed = 100f;
void Update () {
if (Input.GetKey (KeyCode.E)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
if (Input.GetKey (KeyCode.Q)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
}
}
here is the fixed Script for you.