In Brick.cs script, the LoadNextLevel() method is throwing an “LevelManager does not contain a definition for LoadNextLevel”. It seems like Brick.cs cannot access the method in LevelManager.
using UnityEngine;
using System.Collections;
public class Brick : MonoBehaviour {
public int maxHits;
private int timesHit;
private LevelManager levelManager;
// Use this for initialization
void Start () {
timesHit = 0;
levelManager = GameObject.FindObjectOfType<LevelManager> ();
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter2D (Collision2D collide) {
timesHit++;
SimulateWin ();
}
//TODO Remove this method
void SimulateWin() {
levelManager.LoadNextLevel ();
}
}