Hello there! I am trying to write a script which will write a text once I step on a special object and press a special button.
I’ve got a GameObject which is the special object I gonna step on and another GameObject with TextMesh attached to it. Second object is deactivated. Here is a script which will activate my TextMesh object:
void OnTriggerEnter2D(Collider2D other)
{
if (Input.GetButton ("Jump") && other.gameObject.CompareTag("Text"))
{
other.gameObject.transform.GetChild(0).gameObject.SetActive(true);
}
}
But the problem is that it does nothing. How can I fix it?