Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Tiles on August 01, 2013, 06:45:18 AM
-
I am a bit baffled at the moment. Something i did a few dozen times before makes trouble now. I set the text of the label to another string by code at runtime. And the position of the string changes by that.
It`s a small string that i set to "Press Enter" while a conversation, and at the last paragraph to "Move on"
I have reduced the trouble maker to the text positions. When i use the upper left corner as the center of the text, then everything is fine. When i use the center of the string, then i get an offset when i change the text. I need the center because i scale this string in and out to animate it.
I have solved it by offsetting the text in the first place, and change the string to whatever i need. So that the string is offset in every case. But that`s not really a nice solution.
Is this a known issue? Do you know a better workaround or a fix here?
-
A screenshot of your scene view with the label selected would help. Simply changing the text certainly doesn't move the label.
-
Indeed. Changing the text shouldn`t change the position. That`t why i am so baffled :)
I have made a short video where you can see the problem a bit more clear. The label is selected while that.
1.5 MB: http://www.reinerstilesets.de/ext/unity/textchangingposition_x264.mp4
Just that i have mentioned it. The tween script doesn`t have any influence here. The problem is still there when i remove it.
-
Your default "my text" likely has an enter (\n) at the end. Since it's center aligned, it would move it up by a half line.
-
Ha, so simple. Indeed, that was it. You`re a genious. Many thanks :)
-
:)