static public int set_verticalFit(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); UnityEngine.UI.ContentSizeFitter.FitMode v; v = (UnityEngine.UI.ContentSizeFitter.FitMode)LuaDLL.luaL_checkinteger(l, 2); self.verticalFit = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static public int get_horizontalFit(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.horizontalFit); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public override void CollectViews() { base.CollectViews(); root.name = "SharedFitter"; CSF = root.gameObject.AddComponent <UnityEngine.UI.ContentSizeFitter>(); CSF.verticalFit = UnityEngine.UI.ContentSizeFitter.FitMode.PreferredSize; // Scale with the viewport's width. Height unscaled root.anchorMin = Vector2.zero; root.anchorMax = new Vector2(1f, 0f); // Middle-Center pivot to grow downwards on resizing root.pivot = new Vector2(.5f, 1f); // Place it way below the viewport, so it won't be visible. The ScrollView's mask should not allow it to be visible anyway. // Height doesn't matter, because it'll constantly change float height = 1234f; root.SetInsetAndSizeFromParentBottomEdgeWithCurrentAnchors(-30000f, height); // Correctly set its left and right padding according to the parameters, just like the regular items will be placed. // Since this VH is parented to the Viewport, you may wonder why we can use the paddings used for the Content: // In an OSA, the Content and the Viewport always have the same size and position, // so their children will be identically placed if the same insets and sizes are used var padding = _Params.ContentPadding; root.SetInsetAndSizeFromParentLeftEdgeWithCurrentAnchors(padding.left, _Params.Content.rect.width - padding.right); }
private void CreateLabelText(string label, Transform parent) { // Prepare the text game object GameObject textGo = new GameObject("Text", typeof(RectTransform)); textGo.layer = this.gameObject.layer; // Prepare the text rect RectTransform textRt = textGo.transform as RectTransform; textRt.SetParent(parent, false); textRt.pivot = new Vector2(0.5f, 0.5f); textRt.anchorMin = new Vector2(0f, 0.5f); textRt.anchorMax = new Vector2(0f, 0.5f); textRt.localScale = new Vector3(1f, 1f, 1f); textRt.localPosition = Vector3.zero; textRt.anchoredPosition = Vector2.zero; // Prepare the text Text text = textGo.AddComponent <Text>(); text.text = label; text.font = this.m_TextFont; text.fontSize = this.m_TextSize; text.color = this.m_TextColor; // Prepare the content size fitter ContentSizeFitter textCsf = textGo.AddComponent <ContentSizeFitter>(); textCsf.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; textCsf.verticalFit = ContentSizeFitter.FitMode.PreferredSize; }
static public int set_verticalFit(IntPtr l) { UnityEngine.UI.ContentSizeFitter o = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); UnityEngine.UI.ContentSizeFitter.FitMode v; checkEnum(l, 2, out v); o.verticalFit = v; return(0); }
public override void CollectViews() { base.CollectViews(); contentSizeFitter = root.GetComponent <UnityEngine.UI.ContentSizeFitter>(); contentSizeFitter.enabled = false; // the content size fitter should not be enabled during normal lifecycle, only in the "Twin" pass frame root.GetComponentAtPath("TitlePanel/TitleText", out titleText); root.GetComponentAtPath("Icon1Image", out icon1Image); }
public static GameObject CreateLoopHorizontalScrollRect(DefaultControls.Resources resources) { GameObject root = CreateUIElementRoot("LoopHorizontalScrollRect", new Vector2(200, 200)); root.GetAddComponent <Image>().color = Color.gray; GameObject viewPort = CreateViewPort(root.transform); GameObject content = CreateUIObject("Content", viewPort); RectTransform contentRT = content.GetComponent <RectTransform>(); contentRT.anchorMin = new Vector2(0, 1f); contentRT.anchorMax = new Vector2(1, 1f); contentRT.sizeDelta = new Vector2(0, 200); contentRT.pivot = new Vector2(0, 1f); // Setup UI components. LoopHorizontalScrollRect scrollRect = root.AddComponent <LoopHorizontalScrollRect>(); scrollRect.content = contentRT; scrollRect.viewport = null; scrollRect.horizontalScrollbar = null; scrollRect.verticalScrollbar = null; scrollRect.horizontal = true; scrollRect.vertical = false; scrollRect.horizontalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; scrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; scrollRect.horizontalScrollbarSpacing = 0; scrollRect.verticalScrollbarSpacing = 0; CreateHorizontalDefaultScrollBar(root.transform, scrollRect); CreateVerticalDefaultScrollBar(root.transform, scrollRect); Image img = viewPort.AddComponent <Image>(); img.raycastTarget = true; Mask mask = viewPort.AddComponent <Mask>(); mask.showMaskGraphic = false; HorizontalLayoutGroup layoutGroup = content.AddComponent <HorizontalLayoutGroup>(); layoutGroup.childAlignment = TextAnchor.MiddleLeft; layoutGroup.childForceExpandWidth = false; layoutGroup.childForceExpandHeight = true; ContentSizeFitter sizeFitter = content.AddComponent <ContentSizeFitter>(); sizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; sizeFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained; return(root); }
static public int get_verticalFit(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); pushEnum(l, (int)self.verticalFit); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int SetLayoutHorizontal(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); self.SetLayoutHorizontal(); return(0); } catch (Exception e) { return(error(l, e)); } }
/// <inheritdoc/> public override void CollectViews() { base.CollectViews(); // Since the group views holder is created at runtime internally, we also need to add the CSF by code contentSizeFitterComponent = root.gameObject.AddComponent <UnityEngine.UI.ContentSizeFitter>(); contentSizeFitterComponent.verticalFit = UnityEngine.UI.ContentSizeFitter.FitMode.PreferredSize; // Keeping the CSF always enabled is easier to manage. We'll trigger a Twin pass very frequently, anyway contentSizeFitterComponent.enabled = true; }
static public int get_horizontalFit(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.horizontalFit); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int SetLayoutVertical(IntPtr l) { try{ UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); self.SetLayoutVertical(); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int get_horizontalFit(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); pushEnum(l, (int)self.horizontalFit); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int SetLayoutVertical(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); self.SetLayoutVertical(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_verticalFit(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); UnityEngine.UI.ContentSizeFitter.FitMode v; checkEnum(l, 2, out v); self.verticalFit = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static int QPYX_SetLayoutVertical_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 1); UnityEngine.UI.ContentSizeFitter QPYX_obj_YXQP = (UnityEngine.UI.ContentSizeFitter)ToLua.CheckObject <UnityEngine.UI.ContentSizeFitter>(L_YXQP, 1); QPYX_obj_YXQP.SetLayoutVertical(); return(0); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int SetLayoutVertical(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.UI.ContentSizeFitter obj = (UnityEngine.UI.ContentSizeFitter)ToLua.CheckObject(L, 1, typeof(UnityEngine.UI.ContentSizeFitter)); obj.SetLayoutVertical(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int set_horizontalFit(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); UnityEngine.UI.ContentSizeFitter.FitMode v; checkEnum(l, 2, out v); self.horizontalFit = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
protected virtual void Awake() { // Save instance reference mInstance = this; // Get the rect transform this.m_Rect = this.gameObject.GetComponent <RectTransform>(); // Get the canvas group this.m_CanvasGroup = this.gameObject.GetComponent <CanvasGroup>(); // Get the content size fitter this.m_SizeFitter = this.gameObject.GetComponent <ContentSizeFitter>(); }
static public int set_horizontalFit(IntPtr l) { try { UnityEngine.UI.ContentSizeFitter self = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); UnityEngine.UI.ContentSizeFitter.FitMode v; checkEnum(l, 2, out v); self.horizontalFit = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// Rebuilds the options. /// </summary> protected void RebuildOptions() { if (!this.HasOptions()) { return; } // Make sure we have the options container if (this.m_OptionsContGameObject == null) { this.CreateOptionsContainer(); } // Clear out the current options this.DestroyOptions(); // Loop through the options int i = 0; foreach (string option in this.m_Options) { GameObject optionObject = new GameObject("Option " + i.ToString(), typeof(RectTransform), typeof(Image)); optionObject.layer = this.gameObject.layer; optionObject.transform.SetParent(this.m_OptionsContGameObject.transform, false); // Create the text game object GameObject textObject = new GameObject("Text", typeof(RectTransform)); textObject.layer = this.gameObject.layer; textObject.transform.SetParent(optionObject.transform, false); // Add the text component and set the text Text text = textObject.AddComponent <Text>(); text.text = option; // Add content size fitter ContentSizeFitter fitter = textObject.AddComponent <ContentSizeFitter>(); fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; // Add to the game objects list this.m_OptionGameObjects.Add(optionObject); // Increase the indexer i++; } // Update the option properties this.UpdateOptionsProperties(); }
/// <inheritdoc/> public override void CollectViews() { base.CollectViews(); // Since the group views holder is created at runtime internally, we also need to add the CSF by code contentSizeFitterComponent = root.gameObject.AddComponent <UnityEngine.UI.ContentSizeFitter>(); contentSizeFitterComponent.verticalFit = UnityEngine.UI.ContentSizeFitter.FitMode.PreferredSize; // Keeping the CSF always enabled is easier to manage. We'll trigger a Twin pass very frequently, anyway contentSizeFitterComponent.enabled = true; // Each group has a header that's initially hidden root.GetComponentAtPath("HeaderPanel", out _HeaderPanel); _HeaderPanel.GetComponentAtPath("HeaderPanelFit/HeaderText", out _HeaderText); }
void SetSize() { if (rectTransform == null) rectTransform = GetComponent<RectTransform>(); if (contentSizeFitter == null) contentSizeFitter = GetComponent<ContentSizeFitter>(); if (rectTransform.sizeDelta.x > maxWidth) { contentSizeFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; rectTransform.sizeDelta = new Vector2 (maxWidth , rectTransform.sizeDelta.y); } else { contentSizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; } }
static int set_horizontalFit(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.ContentSizeFitter obj = (UnityEngine.UI.ContentSizeFitter)o; UnityEngine.UI.ContentSizeFitter.FitMode arg0 = (UnityEngine.UI.ContentSizeFitter.FitMode)ToLua.CheckObject(L, 2, TypeTraits <UnityEngine.UI.ContentSizeFitter.FitMode> .type); obj.horizontalFit = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index horizontalFit on a nil value")); } }
public static GameObject CreateLoopHorizontalScrollRect(DefaultControls.Resources resources) { GameObject root = CreateUIElementRoot("Loop Horizontal Scroll Rect", new Vector2(200, 200)); GameObject content = CreateUIObject("Content", root); RectTransform contentRT = content.GetComponent <RectTransform>(); contentRT.anchorMin = new Vector2(0, 0.5f); contentRT.anchorMax = new Vector2(0, 0.5f); contentRT.sizeDelta = new Vector2(0, 200); contentRT.pivot = new Vector2(0, 0.5f); // Setup UI components. LoopHorizontalScrollRect scrollRect = root.AddComponent <LoopHorizontalScrollRect>(); scrollRect.content = contentRT; scrollRect.viewport = null; scrollRect.horizontalScrollbar = null; scrollRect.verticalScrollbar = null; scrollRect.horizontal = true; scrollRect.vertical = false; scrollRect.horizontalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; scrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; scrollRect.horizontalScrollbarSpacing = 0; scrollRect.verticalScrollbarSpacing = 0; root.AddComponent <RectMask2D>(); root.AddComponent <YYEmpty4RaycastBtn>(); //为了在任何view的位置都可以拖动 HorizontalLayoutGroup layoutGroup = content.AddComponent <HorizontalLayoutGroup>(); layoutGroup.childAlignment = TextAnchor.MiddleLeft; layoutGroup.childControlHeight = true; layoutGroup.childControlWidth = true; layoutGroup.childForceExpandWidth = false; layoutGroup.childForceExpandHeight = false; ContentSizeFitter sizeFitter = content.AddComponent <ContentSizeFitter>(); sizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; sizeFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained; return(root); }
IEnumerator GetRefresh() { foreach (var mm in technologyBlocks.transform.GetComponentsInChildren<BlockController>()) { StartCoroutine(RefreshBlock(mm)); } yield return new WaitForSeconds(1f); scrnM.ShowCurrentPanel(); loadingPanel.SetActive(false); vlG = technologyBlocks.transform.GetComponent<VerticalLayoutGroup>(); csF = technologyBlocks.transform.GetComponent<ContentSizeFitter>(); le = technologyBlocks.transform.GetComponentInChildren<LayoutElement>(); vlG.enabled = false; csF.enabled = false; le.enabled = false; }
static int get_horizontalFit(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.ContentSizeFitter obj = (UnityEngine.UI.ContentSizeFitter)o; UnityEngine.UI.ContentSizeFitter.FitMode ret = obj.horizontalFit; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index horizontalFit on a nil value" : e.Message)); } }
static int set_verticalFit(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.ContentSizeFitter obj = (UnityEngine.UI.ContentSizeFitter)o; UnityEngine.UI.ContentSizeFitter.FitMode arg0 = (UnityEngine.UI.ContentSizeFitter.FitMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.ContentSizeFitter.FitMode)); obj.verticalFit = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index verticalFit on a nil value" : e.Message)); } }
public void ConstructCompass() { // Destroy the content this.DestroyContent(); // Create the content rect GameObject contentGo = new GameObject("Content", typeof(RectTransform)); contentGo.layer = this.gameObject.layer; // Prepare the rect this.m_ContentRect = contentGo.transform as RectTransform; this.m_ContentRect.SetParent(this.transform, false); this.m_ContentRect.pivot = new Vector2(0f, 0.5f); this.m_ContentRect.localScale = new Vector3(1f, 1f, 1f); this.m_ContentRect.localPosition = Vector3.zero; this.m_ContentRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, this.rectTransform.rect.height); this.m_ContentRect.anchoredPosition = new Vector2(this.headingRectWidth * -1f, 0f); // Prepare the horizontal layout group HorizontalLayoutGroup hlg = contentGo.AddComponent <HorizontalLayoutGroup>(); hlg.childForceExpandWidth = false; hlg.childForceExpandHeight = false; hlg.childControlWidth = true; hlg.childControlHeight = false; // Prepare the content size fitter ContentSizeFitter csf = contentGo.AddComponent <ContentSizeFitter>(); csf.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; // Create the last heading before the first one this.CreateHeading(this.m_HeadingLabels[3]); // Create the headings for (int i = 0; i < 4; i++) { this.CreateHeading(this.m_HeadingLabels[i]); } // Create the first heading after the last this.CreateHeading(this.m_HeadingLabels[0]); }
public static GameObject CreateListViewVertical(DefaultControls.Resources resources) { GameObject root = CreateUIElementRoot("ListView", new Vector2(200, 200)); GameObject content = CreateUIObject("Content", root); RectTransform contentRT = content.GetComponent <RectTransform>(); contentRT.anchorMin = new Vector2(0.5f, 1); contentRT.anchorMax = new Vector2(0.5f, 1); contentRT.sizeDelta = new Vector2(200, 0); contentRT.pivot = new Vector2(0.5f, 1); // Setup UI components. ListView scrollRect = root.AddComponent <ListView>(); scrollRect.content = contentRT; scrollRect.viewport = null; scrollRect.horizontalScrollbar = null; scrollRect.verticalScrollbar = null; scrollRect.direction = LoopScrollRect.eDirection.kVertical; scrollRect.horizontal = false; scrollRect.vertical = true; scrollRect.horizontalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; scrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; scrollRect.horizontalScrollbarSpacing = 0; scrollRect.verticalScrollbarSpacing = 0; root.AddComponent <RectMask2D>(); VerticalLayoutGroup layoutGroup = content.AddComponent <VerticalLayoutGroup>(); layoutGroup.childAlignment = TextAnchor.UpperCenter; layoutGroup.childForceExpandWidth = true; layoutGroup.childForceExpandHeight = false; ContentSizeFitter sizeFitter = content.AddComponent <ContentSizeFitter>(); sizeFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; return(root); }
//private RectTransform canvasRT; public void Awake() { if (text == null) { text = GetComponentInChildren<Text>(); } if (rt == null) { rt = text.GetComponent<RectTransform>(); } if (csf == null) { csf = text.GetComponent<ContentSizeFitter>(); } if (canvas == null) { canvas = GetComponent<Canvas>(); //canvasRT = canvas.GetComponent<RectTransform>(); if (canvas.renderMode != RenderMode.WorldSpace) { Debug.LogWarning(string.Format("To use ScoreFlash with Unity UI in 3D space, you need a canvas with render mode World Space!"), this.gameObject); } } }
protected virtual void Awake() { // Save instance reference mInstance = this; // Get the rect transform this.m_Rect = this.gameObject.GetComponent <RectTransform>(); // Get the canvas group this.m_CanvasGroup = this.gameObject.GetComponent <CanvasGroup>(); // Make sure the tooltip does not block raycasts this.m_CanvasGroup.blocksRaycasts = false; this.m_CanvasGroup.interactable = false; // Get the content size fitter this.m_SizeFitter = this.gameObject.GetComponent <ContentSizeFitter>(); // Prepare the content size fitter this.m_SizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; // Prepare the vertical layout group VerticalLayoutGroup vlg = this.gameObject.GetComponent <VerticalLayoutGroup>(); vlg.childControlHeight = true; vlg.childControlWidth = true; // Make sure we have the always on top component UIAlwaysOnTop aot = this.gameObject.GetComponent <UIAlwaysOnTop>(); if (aot == null) { aot = this.gameObject.AddComponent <UIAlwaysOnTop>(); aot.order = UIAlwaysOnTop.TooltipOrder; } // Hide this.SetAlpha(0f); this.m_VisualState = VisualState.Hidden; this.InternalOnHide(); }
static public int get_verticalFit(IntPtr l) { UnityEngine.UI.ContentSizeFitter o = (UnityEngine.UI.ContentSizeFitter)checkSelf(l); pushEnum(l, (int)o.verticalFit); return(1); }
public void Awake() { if (text == null) { text = GetComponent<Text>(); } if (rt == null) { rt = GetComponent<RectTransform>(); } if (csf == null) { csf = GetComponent<ContentSizeFitter>(); } coloredGraphicsOrigColor.Clear(); foreach (Graphic graphic in coloredGraphics) { coloredGraphicsOrigColor.Add(graphic.color); } }
/// <summary> /// Sets the horizontal fit mode of the tooltip. /// </summary> /// <param name="mode">Mode.</param> protected void Internal_SetHorizontalFitMode(ContentSizeFitter.FitMode mode) { this.m_SizeFitter.horizontalFit = mode; }
/// <summary> /// Sets the horizontal fit mode of the tooltip. /// </summary> /// <param name="mode">Mode.</param> public static void SetHorizontalFitMode(ContentSizeFitter.FitMode mode) { if (mInstance != null) mInstance.Internal_SetHorizontalFitMode(mode); }
protected virtual void Awake() { // Save instance reference mInstance = this; // Get the rect transform this.m_Rect = this.gameObject.GetComponent<RectTransform>(); // Get the canvas group this.m_CanvasGroup = this.gameObject.GetComponent<CanvasGroup>(); // Get the content size fitter this.m_SizeFitter = this.gameObject.GetComponent<ContentSizeFitter>(); }
public void Start() { m_rect = transform.GetComponent<RectTransform>(); m_fitter = gameObject.GetComponent<ContentSizeFitter>(); }