I can't activate my Canvas with my Interactable(Coin) Script and the OnTriggerEnter(). I want to activate the Canvas(show my Text) when my Player collides with my Coin. The Script is in my Coin GameObject. My CoinCollider is on IsTrigger.
public string displayText;
public Text textView;
public GameObject Player;
public Canvas textCanvas;
// Start is called before the first frame update
void Start()
{
textCanvas.enabled = false;
}
// Update is called once per frame
void Update()
{
}
void onTriggerEnter(Collider2D other)
{
if (other.gameObject.tag == "Player")
{
textCanvas.enabled = true;
textView.text = displayText;
}
}
I tried making just the Text appear without a Canvas and watching Tutorials.
The problem is that the method name is "OnTriggerEnter2D" not "onTriggerEnter" for 2D collisions. This sho