using System.Collections; using System.Collections.Generic; using UnityEngine; public class IPhoneXUIFixedScript : MonoBehaviour { private const float CN_SIDE_WIDTH = 0.04f; private Rect _leftSide; private Rect _rightSide; // Use this for initialization void Start() { var size = NGUITools.screenSize; _leftSide = new Rect(0, 0, size.x * CN_SIDE_WIDTH, size.y); _rightSide = new Rect(Screen.width * (1 - CN_SIDE_WIDTH), 0, size.x * CN_SIDE_WIDTH, size.y); } private void OnGUI() { GUI.DrawTexture(_leftSide, Texture2D.blackTexture, ScaleMode.StretchToFill, false); GUI.DrawTexture(_rightSide, Texture2D.blackTexture, ScaleMode.StretchToFill, false); } }