Unity 4.6 Advanced UI Elements - Introduction & Rect Transforms

Pubblicato il: 18 gennaio 2015
sul canale di: ZeuxWarrior
1,367
4

In this first episode, I briefly cover canvas render modes and rect transforms.

Side note: If you want to reuse any of the complex elements discussed in future episodes, stick everything into an empty game object, and drag it into your "Resources" folder to make it a prefab. You can then drag this prefab into the editor to make as many of them as you want.

Code Glossary:

RectTransform rectTransform = gameObject.GetComponent<RectTransform>() - Gets a reference to the RectTransform component on the UI element. Do NOT use gameObject.transform, because that is a different component entirely!
rectTransform.anchorMin - The bottom-left anchor of an element. Coordinate values are typically between 0.0 and 1.0, but can be set beyond those values in code. This is useful to know for scroll rects.
rectTransform.anchorMax - The top-right anchor of an element.
rectTransform.anchoredPosition - The position of an element if both anchors are in the same location. The origin is the bottom-left corner of the parent element.
rectTransform.sizeDelta - Width and height of an element if both anchors are in the same location.
rectTransform.offsetMin - The offset position of the bottom-left vertex of an element from its min anchor. Positive numbers always go right/up from the anchor, while negative numbers always go left/down from the anchor, regardless of how the editor shows them.
rectTransform.offsetMax - The offset position of the top-right vertex of an element from its max anchor.


In questa pagina del sito puoi guardare il video online Unity 4.6 Advanced UI Elements - Introduction & Rect Transforms della durata di ore minuti seconda in buona qualità , che l'utente ha caricato ZeuxWarrior 18 gennaio 2015, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,367 volte e gli è piaciuto 4 spettatori. Buona visione!