How to make sprite in full screen (Independent dimension, univ?

  • what exactly are you trying to do? Ui? even the script is not needed there - Alexey Shimansky

1 answer 1

I understand it is about Canvas / Image

If you manually set, without a C # script, then:

  • For the RectTransform component, select the preset: stretch (lower right corner)

    enter image description here

  • Put:

    1. Left/Top/Right/Bottom Positions to Zero
    2. Anchors minX = minY = 0, maxX = maxY = 1
    3. Pivot for X and Y set equal to 0.5

    enter image description here

If through a script, it will be something like this:

 public RectTransform panelRectTransform; void Start() { panelRectTransform.anchorMin = new Vector2(0, 0); panelRectTransform.anchorMax = new Vector2(1, 1); panelRectTransform.pivot = new Vector2(0.5f, 0.5f); // и прочие атрибуты установить если надо } 

In general, according to the UI, it is a good idea to read about it, including about:

http://docs.unity3d.com/ScriptReference/RectTransform-anchorMin.html http://docs.unity3d.com/ScriptReference/RectTransform-anchorMax.html http://docs.unity3d.com/ScriptReference/RectTransform-pivot. html

video https://unity3d.com/en/learn/tutorials/modules/beginner/ui/rect-transform?playlist=17111