Оk thanks for the answer! I understand
miksol
Recent community posts
Hi! Why don't nested color tags work? for example : <c=#ff00ffff>hello <c=#00ff00ff>wonderful </c> world</c>
in standard TextMesh and UItext it works <color=#ff00ffff>hello <color=#00ff00ff>wonderful </color> world</color>
in our project there are large texts about 10000 chars where a large section is highlighted in color and it is necessary to highlight the numbers of subitems in a different color, now we are doing a simple replacement of numbers with numbers with color tags, but with STM it don't work
Is it possible to implement it?
Thanks!
Thank you! I figured out what positional Y value offset ,
it is in line number 2853 SuperTextMesh.ApplyOffsetDataToTextInfo ()
anchorOffset.y = VerticalLimit> -rawBottomRightTextBounds.y? (-rawBottomRightTextBounds.y rawTopLeftBounds.y - rawBottomRightBounds.y) * 0.5f: 0f;
This happens if only VerticalLimit> -rawBottomRightTextBounds.y respectively.
For my while I just add this offset, you will probably find it easier to figure out where you better need to fix it.
How can i get correct local position of character?
my code for test:
// Use this for initialization
void Start () {
SuperTextMesh stm = GetComponent<SuperTextMesh>();
string stringForSearch = "TEST!";
stm.text = "Hello, World!! Hello, World!! Hello, " + stringForSearch + " World!! Hello, World!! Hello, World!!"
int characterIndex1 = stm.hyphenedText.IndexOf(stringForSearch);
int characterIndex2 = characterIndex1 + stringForSearch.Length -1;
STMTextInfo ti1 = stm.info[characterIndex1];
STMTextInfo ti2 = stm.info[characterIndex2];
Debug.Log(ti1.character + " - " + ti2.character);
Vector2 boxSize = new Vector3(ti2.BottomRightVert.x - ti1.BottomLeftVert.x, stm.size);
Vector3 boxLocalPos = new Vector3(ti1.BottomLeftVert.y + boxSize.x / 2f, ti1.BottomLeftVert.y + boxSize.y/2f, 0);
//create box for test pos
GameObject testObj = new GameObject("TestPosition");
testObj.transform.SetParent(stm.t);
testObj.AddComponent<BoxCollider>().size = boxSize;
testObj.transform.localPosition = boxLocalPos;
}

