Problem with Time.deltaTime
Hi total noob here,
I'm trying to rotate an object in unity using the code example in the documentation. However I'm unable to get the object to rotate at all and when I add a watch on the object in vs code debugger I just get the message:
"Time.deltaTime: Evaluate request failed (unknown member: Time)."
What am I doing wrong?
Here's the offending code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotatePlaneWrapper : MonoBehaviour {
// Use this for initialization
public float rotateSpeed = 50f;
private KeyCode lastHitKey;
// Update is called once per frame
void Update()
{
if(Input.GetKeyDown (KeyCode.D))
{
if(lastHitKey != KeyCode.D)
{
transform.Rotate(Vector3.right * rotateSpeed * Time.deltaTime );
lastHitKey = KeyCode.D;
}
}
if(Input.GetKeyDown (KeyCode.A))
{
if(lastHitKey != KeyCode.A)
{
transform.Rotate(Vector3.left * rotateSpeed * Time.deltaTime );
lastHitKey = KeyCode.A;
}
}
}
}
You mean when you hit key A and D, and look at the Inspector, the object's rotation doesn't change at all?
Answer by Cuttlas-U · Oct 23, 2017 at 06:58 PM
hi; to check your script only look at unity console not vs ; every thing will be there if there is a problem;
remove this lane and check again :
if(lastHitKey != KeyCode.D)
Your answer

Follow this Question
Related Questions
How can I make a ball roll when using Vector3.MoveTowards? 0 Answers
-= Time.deltaTime 1 Answer
i'm using a code to make my cube walk with character controller but when i play the cube spins. 0 Answers
Animations unwanted movement and rotation after updating 0 Answers
copy rotation script doesent copy the full 360 degrees? 0 Answers