Using Top-Down Cam and uGUI to create minimap

Hey community.

I have a environment that I want to have a minimap, But I’m not sure how to go about this. I have a camera in the sky, pointing downwards, and a canvas in front of it, set to “Screen Space - Camera”. I would like to have this camera display dynamic info, concerning the location of gameobjects in the scene, preferably with the Image uGUI components, but how do I go about having the respective images atop their real world location?

Here is the setup I would like to use.

https://gyazo.com/636424d9697722eaed065b085cad3151

seems like a fairly well rounded tutorial. Note that approach doesn’t require a top down “minimap” camera at all. One shortfall that that tutorial has is the “map” is a static texture, if you want you can setup an orthographic top down camera and render what it sees to a RawImage on the minimap’s canvas. You can then limit what it is seeing using the cullingmask option to just pick certain layers in the scene.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class GetCameraTexture : MonoBehaviour
{
    public Camera miniMapCamera;
    public RawImage targetImage;
 

    void Start()
    {
      
miniMapCamera.targetTexture = (RenderTexture)targetImage.texture;
    }
}

edit: code super simplified :slight_smile:

1 Like

One of the features of the minimap I wanted would be a “real life” feed, and I think the RenderTexture idea is perfect. Thank you very much