Hi I am currently trying to make a mini rhythm game system in my project, but how can a UI game object detect when it comes in contact with another UI object. I tried the same a approach with a regular game object using colliders but seems like I don't get anything for the Debug Log?
{
public Vector2 Velocity;
private void OnTriggerEnter2D(Collider2D collision)
{
while (collision.gameObject.CompareTag("QTE Icon Checker"))
{
Debug.Log($"{this.gameObject.name} has made contact with {collision.gameObject.name}");
}
}
// Update is called once per frame
void Update()
{
RectTransform picture = GetComponent<RectTransform>();
picture.anchoredPosition = new Vector2(picture.anchoredPosition.x - Velocity.x, picture.anchoredPosition.y);
}
}```