TextGenerator with Canvas Scaler
Hello,
First my relevant Code
TextGenerator textGen = textToEdit.cachedTextGenerator;
for (int k = 0; k < textGen.GetCharactersArray().Length; k++)
{
GameObject obj = GameObject.Instantiate(prefab);
float x = textGen.GetCharactersArray()[k].cursorPos.x;
float y = textGen.GetCharactersArray()[k].cursorPos.y;
obj.transform.SetParent(textToEdit.transform);
obj.transform.localScale = new Vector3(2f, 2f, 1f);
Vector3 imagePos = new Vector3(x, y, 0);
obj.transform.localPosition = imagePos;
}
This creates small little red dots for each Symbol in a UnityUI.Text element [Image1]. This works fine if my UI Canvas Scaler is set to Constant PIxel Size.
But when i turn the Canvas Scaler to Scale With Screen Size, X:1280, Y:720 and Match:1 I get a distransformed result, which seems "wrong" to me. [Image2]
And on my Mobile device its even distorted in the Y-Axis
Any Idea with what factor i have to scale X and Y to get me the same results as in Image 1 while using Scale with Screen Size ?
scalewithscreensize.jpg
(21.2 kB)
constant.jpg
(26.3 kB)
Comment
Your answer
Follow this Question
Related Questions
Make Text Appear When Looking at Object in VR 1 Answer
Canvas Text Help 0 Answers
How can I check if there is no free space in the Text component? 1 Answer
Canvas Renderer event 0 Answers