Here is my project (latest version Unity 5.4.1f1):
(click the image to see close-up)
“with less and gain” is the complete string in the text component.
There are 6 spaces between the words “less” and “and”.
Try recreating the text with the exact values you see here.
Notice that the word “gain” lies on the next line.
I built, installed, and ran the exact above project on an android phone, hoping to see exactly what I see in the editor.
I took a screenshot here:
To my dismay, the word “gain” has moved back into the previous line on my android phone.
Why? Is it intended? Should it be intended?
All replies are greatly appreciated.
Thanks in advance!
EDIT:
I tested it on a windows.exe build and what I see matches what I see in the unity editor. No problem there.
Sorry, I’m a bit confused as to if there is an actual issue? Different devices will handle fonts a bit differently. If your intent is to simply have gain on the next line, just hit enter before the word gain and it will move it to the next line.
\n inserted into a string will do the same thing if you are populating the text through code.
As far as why this happens, I think it has to do with the difference in resolution on devices. But this is my guess based on other experiences I’ve had.
Firstly, thanks for the reply!
Please allow me to clarify my issue on a higher level.
My intent is to insert tiny custom image (like an emoji) between the words “less” and “and”.
I was thinking of using an emoji sdks from the unity store, but I’ve never got to, since I have always presumed, and am still presuming that different devices treat emoji text from these emoji sdks the same way they treat the default arial text (refer to the rendering issue in the original thread).
I have two other requirements, which are described in this image:
Note: My current set-up attaches gameobjects of heart images (emoji), as children to the text gameobject. And the the entire thing is a prefab.
How would you suggest I fufill these requirements?
I have over 400 prefabs similar to the “stab an opponent’s drake” example above, so using a bitmap image is not in the picture, since maintainability will be practically impossible. I am looking for a solution that makes use of unity game engine.
Do emoji sdks render emoji text exactly the same across different devices?
Any thoughts?
I think it already has the support you want. Check out:
flexibleHeight
flexibleWidth
horizontalOverflow (ding ding ding)
resize
Tons of different variables that can fix your problem. Just take a look and play around with all the settings and functions. You could maybe also apply a layout context/content on it.
The other option is maybe to do some math. based on resolutions, text size, font, etc. Adjust the dimensions of everything.
I’m back, with the screenshot of the final problem.
This is what I see in the editor:
The white squares are where the emoji pictures will be shown. I would expect that to be at its correct position when I run the app on my android device.
However…
This is what I see on my device (this is a crop of the screenshot that I took)
Is this intended behaviour?
Or how would you suggest I go about solving this issue?
All help from peers/professionals/unity team is greatly appreciated.
Thank you in advance!
Isn’t what you see on your mobile correct? This looks like just a difference between editor and mobile. As long as mobile shows what you want… Idk if there is a problem. Could be a difference in the emoji library or like I mentioned before editor vs mobile.
Maybe add another space after the emojis and it will add another? Or perhaps it’s deleting extra white space.
Sorry for the missing explaination of the issue in my previous post.
From my previous post, the issue is that the white squares are offset by quite a noticable amount of pixels relative to the position of the rendered text when the app is run on an android device.
To clarify, no, I am not using any emoji sdks, because I cannot afford any, and there aren’t any free ones on the asset store as shown.
The way that I have been trying (am still trying) to implement emojis/emoticons is by adding several “Image”-s with sprites attached (like a heart), as shown.
Oh sweet! I’ve imported TextPic and the editor cs files and it works like a charm!
Looks like that library collection got some super useful stuff that I can use in the future.
Thanks again for the recommendation!
Hi @IzzySoft , is there a way to type non breaking space into the text field in a text component from the inspector? I’ve tried by copying the nbsp character from the wiki to my clipboard, then pasting it into the text field on the inspector, but to no success.
I couldn’t find any solutions from googling this or this.