I’m trying to create an app where you pop bubbles when you click or touch on them I have it so the bubbles pop when you click but it doesn’t matter where you click you can click anywhere on the screen you don’t have to click the bubbles and they pop I need it so the bubbles pop when you click on them not anywhere else here is the script I have I would appreciate any help you can provide
Thank you
use the OnMouseDown() method
I tried the OnMouseDown() but I got
Error CS0117 ‘Input’ does not contain a definition for ‘OnMouseDown’
This is the script I have been working with I know its missing something I just don’t know what
using UnityEngine;
public class BubblePop : MonoBehaviour
{
public GameObject animBubble;
public Animator animator;
private void Start()
{
animator = GetComponent<Animator>();
}
private void Update()
{
if (Input.GetMouseButton(0))
animator.SetInteger("bubbleState", 1);
{
animBubble.GetComponent<Animation>().Play("bubble");
animator.SetInteger("bubbleState", 0);
}
}
}
here are pics of how my game object is set up