End Game trigger not working (triggering as soon as game starts)

Hey guys, so I have an endgame trigger and a next level button function. As soon as I start the level, the level completes straight away, even though my player is no where near the endgame trigger box collider.

Here are my scripts to show how everything has been setup:
GameFinishTrigger (with trigger collider)

using UnityEngine;

public class GameFinishTrigger : MonoBehaviour {


    public EndGame gameManager;
   

    public void OnTriggerEnter(Collider other)
    {
        gameManager.CompleteLevel();

    }

}

My Game Manager script

using UnityEngine;
using UnityEngine.SceneManagement;

public class EndGame : MonoBehaviour {

    bool endGame = false;

    public GameObject completelevelUI;
    public GameObject youDied;

    public void CompleteLevel ()
    {
        Debug.Log("level won");
        completelevelUI.SetActive(true);
    }

    public void gameover ()
    {
        if (endGame == false)
        {
            endGame = true;
            youDied.SetActive(true);
        }

    }

   
   
}

Any ideas why my game is completing the level straight away, despite my player being nowhere near the trigger? This setup is (as far as I can see) Identical to another level I’ve done and this has not been a problem there.

Any help is appreciated!

Thanks :slight_smile:

If you select the “level won” message in the console, it will show you the stack trace for what made the message be called. So CompletedLevel will be on the top, and the method that called it will be below that and so on. That’ll help you spot what’s going on.

Your end game trigger isn’t checking which collider’s triggering it, so any collider entering it will cause the level to complete. There’s probably something standing inside it when the game starts that fires the message.

Thanks alot! the trigger was indeed colliding with the ground :slight_smile: