I’m trying to make a speech bubble appear when you approach the tutorial board.
The bubble is there and it has its animation states “Appear” and “Disappear”
Appear is called OnTriggerEnter2D
Disappear is called OnTriggerExit2D
The collider is on the parent, tutorial board
The animator and script is on the bubble itself
Can’t add more images due to rules.
This is the script I have attached to the bubble, the conditions script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Conditions : MonoBehaviour
{
private Animator bubblecondition;
private BoxCollider2D boxCollider;
// Start is called before the first frame update
private void Awake()
{
bubblecondition = this.GetComponent<Animator>();
bubblecondition.Play("Disappear", 0, 1f);
}
void Start()
{
//bubblecondition.SetBool("Here", false);
boxCollider = this.GetComponentInParent<BoxCollider2D>();
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
bubblecondition.Play("Appear", 0, 0f);
}
else
{
return;
}
}
public void OnTriggerExit2D(Collider2D other)
{
if (other.tag == "Player")
{
bubblecondition.Play("Disappear", 0, 0f);
}
else
{
return;
}
}
}
What am I doing wrong? I spent an hour trying to know why.
I even tried to have the console write a message on collision but it’s just dead.
Help me see my mistake