40 lines
824 B
C#
Raw Normal View History

2023-06-22 11:07:25 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoftLockPreventer : MonoBehaviour
{
public GameObject toDeactivate;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("SoftLockPreventer: Deactivated");
if (other.gameObject.CompareTag("Player"))
{
toDeactivate.SetActive(false);
}
}
private void OnTriggerExit2D(Collider2D other)
{
Debug.Log("SoftLockPreventer: Activated");
if (other.gameObject.CompareTag("Player"))
{
toDeactivate.SetActive(true);
}
}
}