Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: DarkMagicCK on April 08, 2013, 02:51:58 AM
-
Hello guys, I spent some hours to merge most of the great works done by great people in the top thread, and made a merge package for NGUI 2.5.1.
Here's some merge node:
1. UIFont and UIFontInspector dynamic font support from @Unisip.
2. yOffset logic and inspector support from @zh4ox and @Mudwiz.
3. Support clipping, Clip shaders from great @Nicki. As hard clip is not suggested, use alpha clip instead.
As dynamic fonts are only avaliable in unity 4.x, this package does not support 3.x.
How to use this package to setup dynamic fonts:
1. Import font ttf file and set font size to 1.
2. Create a new gameobject, attach a UIFont script and make this a prefab.
3. Adjust prefab inspector values.
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=3749.0;attach=1735)
Font Type: Choose DYNAMIC.
Font: Drag your ttf file into this slot.
Material: You need to create a new material with "Unlit/Dynamic Text Shader" for each different font, same font with different size can use same material.
Size: the font size you want.
TTF Size: size of the ttf import setting, as this situation, set it to 1.
Const Offset: default the text's y offset is not correct(still no solution yet), and this value can be different for different fonts. You can adjust this value to fit the texts in box, other sizes of the same font will mostly be correct.
4. Create UILabel using this prefab as UIFont and that's it.
-
I tried to import NGUI_2.5.1_DynamicFont.unitypackage -package and I only got an error:
"Fatal error!
type == kMetaAssetType && pathName.find ("library/metadata") != 0"
And then unity crashes.
System: Mac os x 10.7.5
Unity: 3.5.7f6
I fastly tried it with my windows pc and it did give me same error.
-
I tried to import NGUI_2.5.1_DynamicFont.unitypackage -package and I only got an error:
"Fatal error!
type == kMetaAssetType && pathName.find ("library/metadata") != 0"
And then unity crashes.
System: Mac os x 10.7.5
Unity: 3.5.7f6
I fastly tried it with my windows pc and it did give me same error.
NGUI 2.5.1 only support unity 4.0+, so this package is for unity 4.0+
-
Cool package.
A note though - NGUI 2.5.1 supports Unity 3.5.5 and up, but dynamic fonts only work in Unity4 (at least for mobile).
-
In release notes it does not say that ngui is unity 4+ only but 3.5+ (but dynamic font is unity4+ only feature)
-
Cool package.
A note though - NGUI 2.5.1 supports Unity 3.5.5 and up, but dynamic fonts only work in Unity4 (at least for mobile).
lol thanks, I've changed the note.
-
Thanks DarkMagic!
a solution until v.2.6.0 is coming.
-
Thx! Just gave this a shot, and seem to hit a problem with > 1 font. The most recently edited font works fine, while the other dynamic fonts get corrupted. In my case I'm using 3 typefaces, and whatever I edit most recently (ie, just changing the style from Normal to Bold in the panel) will look correct while the other fonts show up as gibberish.
-
Thx! Just gave this a shot, and seem to hit a problem with > 1 font. The most recently edited font works fine, while the other dynamic fonts get corrupted. In my case I'm using 3 typefaces, and whatever I edit most recently (ie, just changing the style from Normal to Bold in the panel) will look correct while the other fonts show up as gibberish.
You need to setup new material for new fonts, I just made one default Material in NGUI/Resources/Material.
Create material with shader Unlit/Dynamic Text Shader anywhere, and put this into new font's prefab.
-
yeps, it happens to me before. You need to check the font material.
-
some time, i meant this solution:in phone, some of the world cannot be printed.
Maybe When UIFont callback OnFontRebuilt() function,some labels were not be repaint in cellphone android environment.
Can you help me ?
ps:
font.dynamicFont.textureRebuildCallback += OnFontRebuilt;
-
Thanks DarkMagic!
a solution until v.2.6.0 is coming.
+1
-
You need to setup new material for new fonts, I just made one default Material in NGUI/Resources/Material.
Create material with shader Unlit/Dynamic Text Shader anywhere, and put this into new font's prefab.
Perfect - working now, thanks!
-
Do I have to create new materials for new fonts, because I met with opposite solutions?
-
You need to setup new material for new fonts, I just made one default Material in NGUI/Resources/Material.
Create material with shader Unlit/Dynamic Text Shader anywhere, and put this into new font's prefab.
One more thing... in looking at the output from my previous screenshot, you'll see the baseline of the font seems off making look a bit like a ransom note. When I used this previously with BMFont (with only using the 'recommended' settings for NGUI) it looked correct. Do you know if there something else I can tweak to make this more even?
-
some time, i meant this solution:in phone, some of the world cannot be printed.
Maybe When UIFont callback OnFontRebuilt() function,some labels were not be repaint in cellphone android environment.
Can you help me ?
ps:
font.dynamicFont.textureRebuildCallback += OnFontRebuilt;
Sorry I do not own an android device, this package has not been tested on android.
Someone else can help?
-
One more thing... in looking at the output from my previous screenshot, you'll see the baseline of the font seems off making look a bit like a ransom note. When I used this previously with BMFont (with only using the 'recommended' settings for NGUI) it looked correct. Do you know if there something else I can tweak to make this more even?
Oh I see that, like one pixel clip.
The char uv info is from UnityEngine.Font, there's not much we can done for this.
Font's texture's filter mode is unchangable either.
Only one thing - the font's importing settings has a Rendering Mode option. I tried OS Default, but the result is like shit.
-
Sorry I do not own an android device, this package has not been tested on android.
Someone else can help?
I found that:in android env,when rebuild dynamicFontMaterial,some of the labels's letters were not be printed to the material.
can these letters be printed first,then cleaned last?
And
when i disable a panel, then enable it, the letters are not be printed,is it?
my sys is android 4.0.4. sony lt26i
-
I got a problem here.Once I set the dynamic font size in prefab, I can not change it anymore(I mean , I can change it in inspector, but it will set back when I am running my project). Can you give me some ideas ? Thanks.
-
Alright. I got a solution.Remove UIFont script,and re-Add it.Now you can set you dynamic font with a new size, Then it will be saved. :o :o
-
Hi!
First of all I'd like to thank you for this job. Using bitmap fonts was a pain in the ass :D
I had a little issue though: I made a label, the text is showing correctly but it's initially rendered in the back of everything, like if the label was under everything else.
I managed to bring it in front touching the Z transform and inserting a negative value. Why the depth is not working ?
When i try to modify it i get this warning: "the widgets underneath this panel are using more than one atlas. You may need to adjust transform position's Z value instead.
-
http://www.tasharen.com/forum/index.php?topic=1858.0
-
Hi there, I got a annoying problem when using the dynamic font.
1. I have one main menu button panel with text on each button (start, options, credits).
2. I have another options panel, with a UITexture background. When I bring this panel up, the font of my button appear in front of my UITexture background of my new panel. I have tried to move the Z axis, value of -1, -5, -100, -200 to bring further forward the panel to the camera, but that doesn't work. I have always my main menu button font text on the front of my UITexture options background.
3. If I changed my dynamic font to a BMFont, the font appear correctly in the back of my UITexture.
Any hints to fix that ? I want to use the dynamic font, not the BMFont.
Thank you.
p.s. The problem is from the UITexture script, if I use UISprite instead, this fix the problem.
-
Const Offset: default the text's y offset is not correct(still no solution yet), and this value can be different for different fonts. You can adjust this value to fit the texts in box, other sizes of the same font will mostly be correct.
this const offset value not saved
when open unity, value becomes 0
but I found solution
go to font importer and change font size what you want.(not 1)
I think const offset is Unnecessary.
-
This solved all my problems! Thanks!
I was having problems with the kerning being all over the place on fonts I was generating. This gets rid of that problem.. and allows for unicode without any issues too!
http://i.imm.io/13eLX.png
-
GREAT JOB =D
-
2.6.0 is out to Pro users and has dynamic font support.
-
2.6.0 is out to Pro users and has dynamic font support.
When can we download?
-
When Pro users say that it's all peachy and there aren't any issues. :)
-
do we have to remove the files of this library before updating to ngui 2.6 ?
if yes, what files ?
-
Just follow the standard NGUI update process -- delete everything.
-
Hi, I'm using NGUI 2.5.1 with this package for dynamic text.
Sometimes I get the whole text messing up like in this picture. Totally randomly, I'm not able to replicate it. When it happens, I just restart the game and soon it goes away.
http://db.tt/7PMaJCDe
What may it be ?
-
I cant try it in Free version :(