I'm trying to rotate an object Cannon when pressing the horizontal arrow keys. My C# script looks like this; but sadly I get parsing error and "Unexpecting symbol '{'" in Unity :(
using UnityEngine; using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
public float HorizontalKeys;
public Transform Cannon;
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetAxis("HorizontalKeys")){
if(Input.GetAxis ("HorizontalKeys" == -1){
Cannon.transform.Rotate(Vector3.right * Time.deltaTime);
Debug.Log("Test");
}if(Input.GetKey ("HorizontalKeys" == 1){
Cannon.transform.Rotate(Vector3.left * Time.deltaTime);
Debug.Log("Test");
}
}
}
}
Finish your if statements with an enclosing ")"