Show Canvas OnTriggerEnter

I am trying to open a Canvas using the OnTriggerEnter method but somehow it doesn’t load. Here’s the code:

public class CanvasTrigger: MonoBehaviour{
		
	public Canvas miniGameCanvas;

	void Start(){

		miniGameCanvas.enabled = false;
	}

	void OnTriggerEnter(Collider other){
		if (other.gameObject.tag == "Capsule") {
			miniGameCanvas.enabled = true;
		}
	}

If anyone has a solution, it would be really appreciated.

Try making it a GameObject instead of a canvas variable.
then : …
instead of using .enable you should use : MiniGameCanvas.setactive(true);
ofcourse set it to false in your start function :
MiniGameCanvas.setactive(false);