So I have JUST started this 2D Space shooter prototype but the Player sprite moves off down diagonally with out any input, in scene view and when built. It does not do this when I play the build on a different computer so I am thinking it may be that Unity is detecting an input of my ‘S’ and ‘D’ keys on my computer. I have no idea why as the code is the most simple code ever.
Thanks in advance.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private Rigidbody2D rb2d;
// Use this for initialization
void Start () {
rb2d = GetComponent<Rigidbody2D>();
}
void FixedUpdate () {
float moveHorizontal = Input.GetAxisRaw("Horizontal");
float moveVertical = Input.GetAxisRaw("Vertical");
Vector2 movement = new Vector2(moveHorizontal, moveVertical);
rb2d.AddForce (movement * speed);
}
}