W
W
WasTabon2021-09-22 16:27:11
Unity
WasTabon, 2021-09-22 16:27:11

OnMouseDown not working correctly?

Game stop code -

public SpawningClickiongETC spawningClickiongETC;
    public GameObject deathPanel;

    private void Start() 
    {
        spawningClickiongETC = GameObject.Find("Main Camera").GetComponent<SpawningClickiongETC>();
    }
    private void OnMouseDown() 
    {
        spawningClickiongETC.ieBool = false;
        deathPanel.gameObject.SetActive(true);
    }

Object click code
public void startDelete()
    {
        StartCoroutine(delete);
    }
    private void OnMouseDown() 
    {
        animator.SetBool("New Bool", true);
        startDelete();
    }
    public IEnumerator delets()
    {
        yield return new WaitForSeconds(toWaitAfterDelete);
        Destroy(gameObject);
    }

614b2ee190f07582556570.png
Here is the collider of the object itself (don't ask why and why it looks like this)
614b2f0f6cf15722767983.pnghere is the background collider, and if you run and poke at the top of this object, it counts it as a background kilk

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NoNameDeveloper, 2021-09-22
@WasTabon

onMouseDown only works with UI

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question