Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to make a gameobject clickable?

Discussion in 'Editor & General Support' started by ksam2, Jan 16, 2015.

  1. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,069
    Hi, I want to make a Cube act like a button and when I click on it something will happen,
    Can anyone help me with that?
    Thanks
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    Put a collider on it and use OnMouseDown.

    --Eric
     
    ksam2 likes this.
  3. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,069
    I do but anywhere I'll click code will be play!
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    No, that's not how OnMouseDown works at all.

    --Eric