Use Code Tags:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WheelRotation : MonoBehaviour
{
private Transform transform;
void Start ()
{
transform = GetComponent<Transform>();
}
void FixedUpdate ()
{
/*Bug: Wheels rotate, but sometimes they rotate more times than needed*/
// Debug.Log(transform.localEulerAngles.y);
if (Input.GetKeyDown(KeyCode.D))
{
transform.Rotate(0,30,0);
}
if (Input.GetKeyDown(KeyCode.A))
{
transform.Rotate(0, -30, 0);
}
if (Input.GetKeyUp(KeyCode.D))
{
transform.Rotate(0,-30,0);
}
if (Input.GetKeyUp(KeyCode.A))
{
transform.Rotate(0, 30, 0);
}
}
}
Next… ‘transform’ is already a property of MonoBehaviour, so your transform field is unnecessary.