
在Unity中制作小地图,首先,需要在X和Z上制作一个平面,一个在Y上。之后,需要一个带有蒙版图像的画布和一个要蒙版的图像。
蒙版大小是100*100,蒙版图像或者地图大小是200*200,是它的一倍就行。最后,需要一个小图像,一个白色,5×5大小就行。

在Mask中确保未选中显示遮罩图形的遮罩组件。

接着我们需要一个空的游戏对象来保存脚本。
例如:
using System.collections;
using System.collections.Generic;using UnityEngine;
using UnityEngine.UI;
public class Enemy : MonoBehaviour
{
[SerializeField] private GameObject _player;
[SerializeField] private Image _map;
// Start is called before the first frame update
// Update is called once per frame
void Update()
{
_map.rectTransform.localPosition = new Vector3(-1*_player.transform.position.x,-1*_player.transform.position.z,0);
}
}
脚本的意义在于当移动玩家时,地图的本地位置将更改为玩家的位置,左右上下移动。
现在就可以测试一下小地图的动态变化啦。

…
以上是关于游戏小地图制作的简单方法,如果你有任何反馈,请随时在本页面下方留言。