123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using UnityEngine;
- [ExecuteInEditMode]
- public class ScreenFill : MonoBehaviour
- {
- private UITexture texture;
- public UITexture UITexture
- {
- get
- {
- if (!texture)
- {
- texture = GetComponent<UITexture>();
- }
- return texture;
- }
- }
- public bool Normal = false;
- // Use this for initialization
- void Start () {
- if (Normal)
- {
- UITexture.width = Screen.width;
- UITexture.height = Screen.height;
- }
- else
- {
- UITexture.width = Screen.height;
- UITexture.height = Screen.width;
- }
-
- }
-
- // Update is called once per frame
- void Update () {
- if (Normal)
- {
- UITexture.width = Screen.width;
- UITexture.height = Screen.height;
- }
- else
- {
- UITexture.width = Screen.height;
- UITexture.height = Screen.width;
- }
- }
- }
|