UnityEngine.UI.RawImage.SetNativeSize C# (CSharp) Method

SetNativeSize() public method

Adjusts the raw image size to make it pixel-perfect.

public SetNativeSize ( ) : void
return void
        public override void SetNativeSize()
        {
            Texture mainTexture = this.mainTexture;
            if (mainTexture != null)
            {
                int num = Mathf.RoundToInt(mainTexture.width * this.uvRect.width);
                int num2 = Mathf.RoundToInt(mainTexture.height * this.uvRect.height);
                base.rectTransform.anchorMax = base.rectTransform.anchorMin;
                base.rectTransform.sizeDelta = new Vector2((float) num, (float) num2);
            }
        }

Usage Example

Example #1
0
    void Start()
    {
        if (TextureList.Count > Index)
        {
            Image.texture = TextureList[Index];
            Image.SetNativeSize();
            Index += 1;
        }

        Countdown.SetActive(true);
        Interface.SetActive(false);
        Cessation.SetActive(false);
    }
All Usage Examples Of UnityEngine.UI.RawImage::SetNativeSize