Search Unity

Unity UI Attaching UI elments to a gameobject/ using UI elments on mobile

Discussion in 'UGUI & TextMesh Pro' started by Sovereign42, Aug 19, 2017.

  1. Sovereign42

    Sovereign42

    Joined:
    Aug 8, 2017
    Posts:
    7
    I'm trying to attach a UI element (anything that'll use .HitTest()) to a script I have on a game object. The idea is to check if a touch object's position is within the area of the game object. I thought I could simply drag a UI element into the script as a public variable but nothing seems to work. I've also tried adding a UI element component to the game object but It won't show up in game.

    If there is a better way to register a touch and maintain whether it is being held within a specific region I would love to know.