Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Make UI Image hover over gameobject?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Treasureman, Oct 28, 2015.

  1. Treasureman

    Treasureman

    Joined:
    Jul 5, 2014
    Posts:
    563
    I'm making an FPS puzzle game, and I'm having some trouble with the UI. I want to make a UI image hover around a certain game object, like what most First Person Shooters to show objectives. Here are some examples...

    Destiny: Screenshot (603).png Screenshot (604).png

    Call of Duty: Black Ops:
    Screenshot (605).png Screenshot (606).png
    How would I do this with a UI Image? What kind of canvas would I need to set up?
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,292
    The key point here is the Camera's method WorldToScreenPoint.

    It gives you where on the screen some point in the world is.

    Then you'll have to position your image on some canvas at that point, and offset it based on your needs.