Search Unity

Keep gameobject in same position on screen regardless of resolution?

Discussion in 'Scripting' started by QuinnWinters, Mar 2, 2015.

  1. QuinnWinters

    QuinnWinters

    Joined:
    Dec 31, 2013
    Posts:
    494
    I have a gameobject I'm using as a mini-map, always shown in the top corner of the screen with a separate orthographic camera. I want the mini-map gameobject to stay in the same location on the screen regardless of what size the screen is. I can easily do this with a gui element using a rect, but so far all my attempts to do something similar with the world coordinates of the gameobject have met with failure. Is there a way to accomplish this or am I out of luck unless I'm using gui elements?

    Edit: I thought it would be worth adding that I have been able to do this to some degree using gui, but with gui I can only do a square mini-map using drawtexture. What I'm working with is a round mini-map using a material with a masking shader and a rendertexture on a quad, and it seems you can't use materials when using gui drawtexture.
     
    Last edited: Mar 2, 2015