Unity3D – Circular Minimap add Minimap Icons dynamically through scripting | Free Script | Part 3


This is part 3 of this tutorial. If you haven’t seen the first part, click HERE.

In this part, we’ll learn how to add Icons on the Minimap (Player, Enemy, etc) dynamically and without scripting.


I assume that you’re following this tutorial series from the beginning. So you’ve what we did in part 2.

  • Create your Enemies (if you already have, good for you)
  • Create an empty GameObject as a child of each enemy
  • Add Sprite Renderer component on this empty GameObject
  • Assign Minimap layer to this GameObject (or any layer that you chose to be shown/rendered only on Minimap)
  • Set its position, scale and rotation so that, it looks appropriate on Minimap
  • Now, make prefabs of all the enemies you have by dragging and dropping them in Project view
  • Create a new C# Script named “Spawner.cs”
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawner : MonoBehaviour {

	public GameObject[] Prefab;
	public float Time;

	void Start () {
		StartCoroutine (SpawnCO());
	IEnumerator SpawnCO () {
		yield return new WaitForSeconds (Time);
		Instantiate (Prefab[Random.Range(0, Prefab.Length)], new Vector3(Random.Range(-50, 50), 0, Random.Range(-50, 50)), Quaternion.Euler(new Vector3(0,0,0)));
		StartCoroutine (SpawnCO());

Download the Script HERE.

  • Assign the Script to any GameObject
  • Assign all enemy prefabs and time (time delay before every spawn) in the Inspector panel

That’s how you dynamically add Icons in your Minimap.

To download the complete demo project click HERE.

Watch this tutorial step by step on YoutTube HERE.

To make this Minimap circular, click HERE.

Tags: , , , , , , , , , , , , , ,

Leave a Reply

Notify of