public void AddInlineGraphicsChild() { if (m_inlineGraphic != null) { //Debug.LogWarning("A child Inline Graphics object already exists."); return; } GameObject inlineGraphicObj = new GameObject("Inline Graphic"); m_inlineGraphic = inlineGraphicObj.AddComponent<InlineGraphic>(); m_inlineGraphicRectTransform = inlineGraphicObj.GetComponent<RectTransform>(); m_inlineGraphicCanvasRenderer = inlineGraphicObj.GetComponent<CanvasRenderer>(); m_inlineGraphicRectTransform.SetParent(transform, false); m_inlineGraphicRectTransform.localPosition = Vector3.zero; m_inlineGraphicRectTransform.anchoredPosition3D = Vector3.zero; m_inlineGraphicRectTransform.sizeDelta = Vector2.zero; m_inlineGraphicRectTransform.anchorMin = Vector2.zero; m_inlineGraphicRectTransform.anchorMax = Vector2.one; m_TextMeshPro = gameObject.GetComponent<TextMeshPro>(); m_TextMeshProUI = gameObject.GetComponent<TextMeshProUGUI>(); }
public void AddInlineGraphicsChild() { if (m_inlineGraphic != null) { //Debug.LogWarning("A child Inline Graphics object already exists."); return; } GameObject inlineGraphicObj = new GameObject("Inline Graphic"); m_inlineGraphic = inlineGraphicObj.AddComponent <InlineGraphic>(); m_inlineGraphicRectTransform = inlineGraphicObj.GetComponent <RectTransform>(); m_inlineGraphicCanvasRenderer = inlineGraphicObj.GetComponent <CanvasRenderer>(); m_inlineGraphicRectTransform.SetParent(transform, false); m_inlineGraphicRectTransform.localPosition = Vector3.zero; m_inlineGraphicRectTransform.anchoredPosition3D = Vector3.zero; m_inlineGraphicRectTransform.sizeDelta = Vector2.zero; m_inlineGraphicRectTransform.anchorMin = Vector2.zero; m_inlineGraphicRectTransform.anchorMax = Vector2.one; m_TextMeshPro = gameObject.GetComponent <TextMeshPro>(); m_TextMeshProUI = gameObject.GetComponent <TextMeshProUGUI>(); }
public void AddInlineGraphicsChild() { if (!(m_inlineGraphic != null)) { GameObject gameObject = new GameObject("Inline Graphic"); m_inlineGraphic = gameObject.AddComponent <InlineGraphic>(); m_inlineGraphicRectTransform = gameObject.GetComponent <RectTransform>(); m_inlineGraphicCanvasRenderer = gameObject.GetComponent <CanvasRenderer>(); m_inlineGraphicRectTransform.SetParent(base.transform, worldPositionStays: false); m_inlineGraphicRectTransform.localPosition = Vector3.zero; m_inlineGraphicRectTransform.anchoredPosition3D = Vector3.zero; m_inlineGraphicRectTransform.sizeDelta = Vector2.zero; m_inlineGraphicRectTransform.anchorMin = Vector2.zero; m_inlineGraphicRectTransform.anchorMax = Vector2.one; m_TextMeshPro = base.gameObject.GetComponent <TextMeshPro>(); m_TextMeshProUI = base.gameObject.GetComponent <TextMeshProUGUI>(); } }
public void AddInlineGraphicsChild() { if (this.m_inlineGraphic == null) { GameObject obj2 = new GameObject("Inline Graphic"); this.m_inlineGraphic = obj2.AddComponent <InlineGraphic>(); this.m_inlineGraphicRectTransform = obj2.GetComponent <RectTransform>(); this.m_inlineGraphicCanvasRenderer = obj2.GetComponent <CanvasRenderer>(); this.m_inlineGraphicRectTransform.SetParent(base.transform, false); this.m_inlineGraphicRectTransform.localPosition = Vector3.zero; this.m_inlineGraphicRectTransform.anchoredPosition3D = Vector3.zero; this.m_inlineGraphicRectTransform.sizeDelta = Vector2.zero; this.m_inlineGraphicRectTransform.anchorMin = Vector2.zero; this.m_inlineGraphicRectTransform.anchorMax = Vector2.one; this.m_TextMeshPro = base.gameObject.GetComponent <TextMeshPro>(); this.m_TextMeshProUI = base.gameObject.GetComponent <TextMeshProUGUI>(); } }
void Awake() { // Make sure this component is attached to an object which contains a TextMeshPro or TextMeshPro UI Component. if (gameObject.GetComponent<TextMeshPro>() == null && gameObject.GetComponent<TextMeshProUGUI>() == null) Debug.LogWarning("The InlineGraphics Component must be attached to a TextMesh Pro Object"); // Add a Child GameObject to the TextMeshPro Object if one is not already present. if (m_inlineGraphic == null) { GameObject inlineGraphicObj = new GameObject("Inline Graphic"); m_inlineGraphic = inlineGraphicObj.AddComponent<InlineGraphic>(); m_inlineGraphicRectTransform = inlineGraphicObj.GetComponent<RectTransform>(); m_inlineGraphicCanvasRenderer = inlineGraphicObj.GetComponent<CanvasRenderer>(); m_inlineGraphicRectTransform.SetParent(transform, false); m_inlineGraphicRectTransform.localPosition = Vector3.zero; m_inlineGraphicRectTransform.anchoredPosition3D = Vector3.zero; m_inlineGraphicRectTransform.sizeDelta = Vector2.zero; m_inlineGraphicRectTransform.anchorMin = Vector2.zero; m_inlineGraphicRectTransform.anchorMax = Vector2.one; m_TextMeshPro = gameObject.GetComponent<TextMeshPro>(); m_TextMeshProUI = gameObject.GetComponent<TextMeshProUGUI>(); } }