using SHADE; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SHADE_Scripting.UI { public class ScoreTextDigitPositioning:Script { [NonSerialized] Vector3 defaultPosition; public float offsetPerDigit = 0.0f; protected override void awake() { Transform trans = GetComponent(); if(trans) { defaultPosition = trans.LocalPosition; } } protected override void update() { TextRenderable text = GetComponent(); Transform trans = GetComponent(); if (trans && text) { String str = text.Text; Vector3 offset = new Vector3((str.Length - 1) * offsetPerDigit, 0.0f, 0.0f); trans.LocalPosition = defaultPosition - offset; } } } }