Hey I wanted to detect if my player is colliding with my game object. It works in my first scene but it doesnt in my second. I don't get the dubug.log "awsner" and my panal doesnt activate. Do you know any reasons for this problem?
Here is the Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class NextLevelCollision1 : MonoBehaviour
{
public GameObject NextLevelPanal;
// Start is called before the first frame update
void Awake()
{
NextLevelPanal.SetActive(false);
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter(Collider collider)
{
if(collider.gameObject == CompareTag("NextLevel"))
{
NextLevelPanal.SetActive(true);
Debug.Log("PANALACTIVE");
Cursor.lockState = CursorLockMode.Confined;
}
}
}