HELP the completeLevel function doesnt work (c#),why doesnt my trigger object work?
using UnityEngine; using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
bool GameHasEnded = false;
public void CompleteLevel()
{
Debug.Log("pls");
}
public void EndGame() { if (GameHasEnded == false) { GameHasEnded = true; Restart();
}
}
void Restart() { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } } this is the script for the game manager that needs to show a messege when the player colides whith the trigger but i cant link it :(
using UnityEngine;
public class EndTrigger : MonoBehaviour { public GameManager gameManager;
void OnTriggerEvent() { gameManager.CompleteLevel;//this is underlined red i dont know why } } this is the scrip for the trigger object,please help, excuse my bad english ,im very frustated, please i hepl me fix this! script for game manager:
using UnityEngine; using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
bool GameHasEnded = false;
public void CompleteLevel()
{
Debug.Log("pls");
}
public void EndGame() { if (GameHasEnded == false) { GameHasEnded = true; Restart();
}
}
void Restart() { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } } this is the script of the game manager that restarts the level and shows a messege when you pass throug the trigger, but the "CompleateLevel" fuction is underlined red and doesent let me link the manager to the triger script for the trigger:
using UnityEngine;
public class EndTrigger : MonoBehaviour { public GameManager gameManager;
void OnTriggerEvent() { gameManager.CompleteLevel; } } please help im going nuts, excuse my bad english
Your answer
Follow this Question
Related Questions
Camera Switch error 0 Answers
Same code in 2 different scripts with different outcomes 0 Answers
Why do I keep getting this error? 1 Answer