For some reason when I use triggered in my code it’s not functioning, and I get no errors. This is the script. also, I checked the player has the player tag on it. If anyone can help, I’ll appreciate it
using UnityEngine;
public class DoorWarp : MonoBehaviour
{
public string DoorID;
public string TargetDoor;
Vector2 target;
GameObject player;
PlayerControls playerControls;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
player = GameObject.FindGameObjectWithTag("Player");
playerControls = player.GetComponent<Movement>().controls;
GameObject[] doors = GameObject.FindGameObjectsWithTag("Door");
foreach (GameObject door in doors)
{
if(door.GetComponent<DoorWarp>().DoorID == TargetDoor)
{
target = door.transform.position;
}
}
}
public void EnterDoor()
{
player.transform.position = target;
}
private void OnTriggerStay2D(Collider2D collider)
{
if (collider.CompareTag("Player") && playerControls.Land.DoorEnter.triggered)
{
Debug.Log("Interacted");
EnterDoor();
}
}
}