- Home /
How can I make a clickable/functional RTS style minimap?
Hello,
I am creating a 2D RTS game and am trying to make a interactable and nice looking minimap. Most of the questions I find are either outdated, the minimap is clickable but ugly looking, or I can place the map on the canvas using a rendered texture and Raw Image, but I can't make it clickable. And by clickable I just mean it moves the main camera to the corresponding spot in the scene.
The minimap camera I have currently is/has the following:
Orthorgraphic, with a depth higher than the main camera
The camera is in the top-right corner by fiddling with the viewport rect.
I have it clickable with the following code attached to the minimap camera:
if (GetComponent<Camera>().pixelRect.Contains(Input.mousePosition) && Input.GetMouseButtonDown(0)) { Ray MouseRay = GetComponent<Camera>().ScreenPointToRay(Input.mousePosition); Camera.main.transform.position = MouseRay.origin; }
I would like to be able to make it look nicer with a border and such, but all the answers I found say I need to render it to a texture and place it on the canvas. This, of course, messes with the functionality of making it clickable.
Any ideas on how to make it work and be nice looking?
Your answer
Follow this Question
Related Questions
Draw minimap on panel 2 Answers
Raycast through rendertexture gui minimap 0 Answers
Unity 5 GUI Buttons Won't Show When Built 0 Answers
3rd party UI - World Canvas or Screen Space Camera? 0 Answers