Hello there!
So, I’ve this C# script to print a texture in the camera, and resize the texture according with the size of the screen, having the base resolution with 1080px of height. But somehow the texture doesn’t show up. Here’s the code:
`
using UnityEngine;
using System.Collections;
public class GuiScript : MonoBehaviour {
public Texture LeftTexture;
public Texture HpTexture;
public float LeftTextHeight = 316; //
public float LeftTextWidth = 356;
public float Padding = 2;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
//GUI Design
void OnGUI () {
if (!LeftTexture || !HpTexture) {
Debug.LogError("Assign a Texture in the inspector.");
return;
}
float SizeRelate = Screen.height/1080;
GUI.DrawTexture(new Rect(Padding, Screen.height - ((LeftTextHeight * SizeRelate) + Padding), LeftTextWidth * SizeRelate, LeftTextHeight * SizeRelate), LeftTexture, ScaleMode.ScaleToFit, true, 0);
}
}`
And thanks for the help