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

3d object as button?

Discussion in 'UGUI & TextMesh Pro' started by Arowx, Nov 1, 2014.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Hi I thought I could just drag a button component onto a 3D object and it would work like a button (automatically add the required collider) and trigger events?

    Shouldn't the button component work with 3D objects?
     
  2. FoWare

    FoWare

    Joined:
    May 24, 2013
    Posts:
    13
    Does it have a RectTransform attached?
     
  3. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Tried replacing the transform with a RectTransform and it still doesn't work!
     
  4. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    Place 3d psychical raycasyter onto camera. Try ui cam if exist then main cam
    As i think you dont need rect transform raycaster should be enough
     
    Arowx likes this.
  5. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    :D That's the trick, thank you.

    Checked no need for a rectTransform, but you do need a collider.
     
  6. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Maybe Unity could automagically add the needed components once a button is dropped on a 3D object!?