I am trying to follow one online tutorial to make a simple game. and I am getting this error
object reference is required to access non-static member ‘GameManager.CompleteLever()’
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
public float moveSpeed;
private Vector3 input;
private Vector3 spawn;
public float maxSpeed;
public GameObject deathParticles;
void Start () {
spawn = transform.position;
}
void Update () {
input = new Vector3(Input.GetAxisRaw("Horizontal"),0,Input.GetAxisRaw("Vertical"));
if (GetComponent<Rigidbody>().velocity.magnitude < maxSpeed)
{
GetComponent<Rigidbody>().AddForce(input * moveSpeed);
}
if (transform.position.y < -3)
{
Die();
}
}
void OnCollisionEnter(Collision other)
{
if (other.transform.tag == "Enemy")
{
Die();
}
}
void OnTriggerEnter(Collider other)
{
if (other.transform.tag == "Goal")
{
GameManager.CompleteLevel();
}
}
void Die()
{
Instantiate(deathParticles, transform.position, Quaternion.identity);
transform.position = spawn;
}
}