using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; [ExecuteAlways] public class CryptoTextPrefixer : MonoBehaviour { //thomas09. This script goes on the Icon Object next to the text! [Header("Settings")] [SerializeField] private TMP_Text _text; [SerializeField] private float _xOffset; private void LateUpdate() { if (_text == null) return; float textWidth = _text.preferredWidth; Vector2 textPos = _text.rectTransform.anchoredPosition; float finalX = textPos.x - textWidth / 2f + _xOffset; ((RectTransform)transform).anchoredPosition = new Vector2(finalX, textPos.y); } }