I am a novice to game development so I am following a space shooter unity tutorial. However, after copying the code for player movement completely to the word my code still doesn't compile, despite no errors showing. If possible could someone check my code and see if I have missed an error, if not what can I do to make my code compile?
Code:
using UnityEngine;
[System.Serializable]
public class Boundary {
public float xMin,
xMax,
zMin,
zMax;
}
public class PlayerController: MonoBehaviour {
public float speed;
public float tilt;
public Boundary boundary;
private Rigidbody rb;
void Start() {
rb = GetComponent < Rigidbody > ();
}
void FixedUpdate() {
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.velocity = movement * speed;
rb.position = new Vector3(
Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax), 0.0f, Mathf.Clamp(rb.position.z, boundary.zMin, boundary.zMax));
rb.rotation = Quaternion.Euler(0.0f, 0.0f, rb.velocity.x * -tilt);
}
}
using System.