Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
TMP extension for single file
Browse files Browse the repository at this point in the history
Helpful for numbers
  • Loading branch information
kamyker authored Oct 9, 2020
1 parent ce081eb commit 97de96f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Unity/TextMeshProExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ namespace Cysharp.Text
{
public static partial class TextMeshProExtensions
{
public static void SetText<T>(this TMP_Text text, T arg0)
{
using ( var sb = new Cysharp.Text.Utf16ValueStringBuilder( true ) )
{
sb.Append(arg0);
var array = sb.AsArraySegment();
text.SetCharArray(array.Array, array.Offset, array.Count);
}
}

public static void SetTextFormat<T0>(this TMP_Text text, string format, T0 arg0)
{
using (var sb = new Cysharp.Text.Utf16ValueStringBuilder(true))
Expand Down Expand Up @@ -182,4 +192,4 @@ public static void SetTextFormat<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T1
}

}
}
}

0 comments on commit 97de96f

Please sign in to comment.