protected override void OnEnable() { //find the settings object and its canvas. FindParentSettings(); //If there is an update to the graphic, we cant reuse old vertices, so new tesselation will be required myGraphic = GetComponent <Graphic>(); if (myGraphic) { myGraphic.RegisterDirtyMaterialCallback(TesselationRequiredCallback); myGraphic.SetVerticesDirty(); } //add text events and callbacks myText = GetComponent <Text>(); if (myText) { myText.RegisterDirtyVerticesCallback(TesselationRequiredCallback); Font.textureRebuilt += FontTextureRebuiltCallback; } #if CURVEDUI_TMP || TMP_PRESENT myTMP = GetComponent <TextMeshProUGUI>(); myTMPSubMesh = GetComponent <CurvedUITMPSubmesh>(); #endif }
void FindSubmeshes() { foreach (TMP_SubMeshUI sub in GetComponentsInChildren <TMP_SubMeshUI>()) { m_tempSubMsh = sub.gameObject.AddComponentIfMissing <CurvedUITMPSubmesh>(); if (!subMeshes.Contains(m_tempSubMsh)) { subMeshes.Add(m_tempSubMsh); } } }
private void FindSubmeshes() { foreach (TMP_SubMeshUI hui in base.GetComponentsInChildren <TMP_SubMeshUI>()) { CurvedUITMPSubmesh item = hui.gameObject.AddComponentIfMissing <CurvedUITMPSubmesh>(); if (!this.subMeshes.Contains(item)) { this.subMeshes.Add(item); } } }
protected override void Awake() { base.Awake(); myGraphic = GetComponent <Graphic>(); myText = GetComponent <Text>(); #if CURVEDUI_TMP || TMP_PRESENT myTMP = GetComponent <TextMeshProUGUI>(); myTMPSubMesh = GetComponent <CurvedUITMPSubmesh>(); #endif }
protected override void OnEnable() { this.FindParentSettings(false); this.myGraphic = base.GetComponent <Graphic>(); if (this.myGraphic) { this.myGraphic.RegisterDirtyMaterialCallback(new UnityAction(this.TesselationRequiredCallback)); this.myGraphic.SetVerticesDirty(); } this.myText = base.GetComponent <Text>(); if (this.myText) { this.myText.RegisterDirtyVerticesCallback(new UnityAction(this.TesselationRequiredCallback)); Font.textureRebuilt += new Action <Font>(this.FontTextureRebuiltCallback); } this.myTMP = base.GetComponent <TextMeshProUGUI>(); this.myTMPSubMesh = base.GetComponent <CurvedUITMPSubmesh>(); }