For some reason, the Remove() function does not seems to work in this particular case.
When my character enter the trigger of an object, this object is added to the interactables list. When my character exit the trigger of this object, this object is removed from the interactables list.
Although the object removed is contained in the list, it still doesn’t work. Any idea?
List<GameObject> interactables = new List<GameObject>();
public void AddInteractable(GameObject interactable)
{
interactables.Add(interactable);
}
public void RemoveInteractable(GameObject interactable)
{
interactables.Remove(obj);
}
Thanks!