Assets/NewBehaviourScript.cs(19,19): error CS1502: The best overloaded method match for `UnityEngine.Input.GetKeyDown(string)’ has some invalid arguments.
Assets/NewBehaviourScript.cs(25,19): error CS1503: Argument #1' cannot convert object’ expression to type `string’
Assets/NewBehaviourScript.cs(30,38): error CS0117: UnityEngine.KeyCode' does not contain a definition for d’
Whote problem?
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour
{
public float moveSpeed = 3f;
// Use this for initialization
void Start()
{ }
// Update is called once per frame
void Update()
{
//Moves Forward and back along z axis //Up/Down
if (Input.GetKeyDown(KeyCode.w))
{ //transform.Translate(Vector3.forward+1);
Debug.Log(‘w’);
}
if (Input.GetKeyDown(KeyCode.s))
{
Debag.log(‘s’); //transform.Translate(Vector3.forward - 1);
}
//Moves Left and right along x Axis //Left/Right
if (Input.GetKeyDown(KeyCode.a))
{
Debug.Log(‘a’); //transform.Translate(Vector3.right + 1);
}
if (Input.GetKeyDown(KeyCode.d))
{
Debug.Log(‘d’);
// transform.Translate(Vector3.right - 1);
}
// float h = Input.GetAxis(“horizontal”);
// float v = Input.GetAxis(“Vertical”);
// transform.position = new Vector3(h, v, 0) * moveSpeed * Time.deltaTime;
}
}
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour
{
public float moveSpeed = 3f;
// Use this for initialization
void Start()
{ }
// Update is called once per frame
void Update()
{
//Moves Forward and back along z axis //Up/Down
if (Input.GetKeyDown(KeyCode.W))
{
transform.Translate(Vector3.forward+1);
Debug.Log('w');
}
if (Input.GetKeyDown(KeyCode.S))
{
Debug.Log('s');
transform.Translate(Vector3.forward - 1);
}
//Moves Left and right along x Axis //Left/Right
if (Input.GetKeyDown(KeyCode.A))
{
Debug.Log('a');
transform.Translate(Vector3.right + 1);
}
if (Input.GetKeyDown(KeyCode.D))
{
Debug.Log('d');
transform.Translate(Vector3.right - 1);
}
// float h = Input.GetAxis("horizontal");
// float v = Input.GetAxis("Vertical");
// transform.position = new Vector3(h, v, 0) * moveSpeed * Time.deltaTime;
}
}
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour
{
public float moveSpeed = 3f;
// Use this for initialization
void Start()
{ }
// Update is called once per frame
void Update()
{
//Moves Forward and back along z axis //Up/Down
if (Input.GetKeyDown(KeyCode.W))
{
transform.Translate(Vector3.forward * (moveSpeed * Time.deltaTime));
Debug.Log("w");
}
if (Input.GetKeyDown(KeyCode.S))
{
Debug.Log("s");
transform.Translate(-Vector3.forward * (moveSpeed * Time.deltaTime));
}
//Moves Left and right along x Axis //Left/Right
if (Input.GetKeyDown(KeyCode.A))
{
Debug.Log("a");
transform.Translate(Vector3.right * (moveSpeed * Time.deltaTime));
}
if (Input.GetKeyDown(KeyCode.D))
{
Debug.Log("d");
transform.Translate(-Vector3.right * (moveSpeed * Time.deltaTime));
}
// float h = Input.GetAxis("horizontal");
// float v = Input.GetAxis("Vertical");
// transform.position = new Vector3(h, v, 0) * moveSpeed * Time.deltaTime;
}
}