Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MiniMapGUI : MonoBehaviour {
public RenderTexture MiniMapTexture;
public Texture2D MiniMapHope;
public Material MiniMapMat;
float offset = 10;
public GameObject _cc;
float CamSize = 45f;
void Update ()
{
Vector3 pos = _cc.transform.position;
gameObject.transform.position = new Vector3 (pos.x, 40f, pos.z);
gameObject.GetComponent<Camera> ().orthographicSize = CamSize;
}
void OnGUI ()
{
if (Event.current.type == EventType.Repaint)
{
Graphics.DrawTexture(new Rect(Screen.width - 1560 - offset, offset, 256, 256), MiniMapTexture, MiniMapMat);
Graphics.DrawTexture (new Rect (Screen.width - 1560 - offset * 2, 0, 256 + offset * 2, 256 + offset * 2), MiniMapHope);
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class MiniMapGUI : MonoBehaviour {
public RenderTexture MiniMapTexture;
public Texture2D MiniMapHope;
public Material MiniMapMat;
float offset = 10;
public GameObject _cc;
float CamSize = 45f;
void Update ()
{
Vector3 pos = _cc.transform.position;
gameObject.transform.position = new Vector3 (pos.x, 40f, pos.z);
gameObject.GetComponent<Camera> ().orthographicSize = CamSize;
}
void OnGUI ()
{
if (Event.current.type == EventType.Repaint)
{
Graphics.DrawTexture(new Rect(Screen.width - 1560 - offset, offset, 256, 256), MiniMapTexture, MiniMapMat);
Graphics.DrawTexture (new Rect (Screen.width - 1560 - offset * 2, 0, 256 + offset * 2, 256 + offset * 2), MiniMapHope);
}
}
}
_сс это игрок если что
Я решил этот вопрос путём удаления лишних строк и умножения Screen.width на 0.0025
Вот часть кода:
Синтаксис:
Используется csharp
Graphics.DrawTexture(new Rect(Screen.width * 0.0025f, Screen.height - 260, 256, 256), MiniMapTexture, MiniMapMat);
Graphics.DrawTexture(new Rect(Screen.width * 0.0025f, Screen.height - 260, 256, 256), MiniMapHope);
Graphics.DrawTexture(new Rect(Screen.width * 0.0025f, Screen.height - 260, 256, 256), MiniMapHope);
Может кому поможет