Answer the question
In order to leave comments, you need to log in
Wrong C# script?
I have 2 scripts for 3D object
PlayController
using UnityEngine;
public class PlayController : MonoBehaviour
{
[SerializeField]
private float speed = 5f;
void Update(){
if(Input.GetKey (KeyCode.D)){
transform.Translate(Vector3.right * Time.deltaTime * speed);
}
if(Input.GetKey (KeyCode.A)){
transform.Translate(Vector3.left * Time.deltaTime * speed);
}
if(Input.GetKey (KeyCode.W)){
transform.Translate(Vector3.forward * Time.deltaTime * speed);
}
if(Input.GetKey (KeyCode.S)){
transform.Translate(Vector3.back * Time.deltaTime * speed);
}
if
}
}
using UnityEngine;
public class PlayMotor : MonoBehaviour
{
void Update(){
float yRot = Input.GetAxisRaw("Mouse X");
transform.Rotate(0, yRot, 0);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question