Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - timt

Pages: [1]
1
Actually, now that I think about it, your code won't work. The problem being that width and height being passed into UpdateNGUIText is generally mWidth and mHeight and wouldn't be updated until the ProcessText call and therefore rectWidth and rectHeight would be incorrect.

2
Almost the same. I was doing the density check and call to ProcessText at the top of OnFill. Your solution is better.

3
I think I have the same or very similar issue and I'm on the latest code. Try these steps :

1. New scene.
2. ALT+SHIFT+L, chose Arial, size 25, Resize Freely, typed "MISSIONS" for text. Choose Keep Crisp - Always.
3. UIRoot changed to fixed size, 1200.
4. Add a TweenColor to the label. Set the target color to something. Set the start delay to 5 seconds.
5. Shrink your editor window to as small as you can vertically. This works best if the layout has the game view by itself vertically so you can make it very short.
6. Run. Then quickly enlarge the editor window to as tall as you can make it.
7. When the tween color goes off the label should wrap the last character.

As far as I can tell, the problem is that when mWidth is determined in ProcessText, this is based on the starting pixel density, but when it's drawn in NGUIText.Print it's using whatever the current pixel density is, and that can cause wrapping to occur. My simple fix is to save the pixel density used to calculate CalculatePrintedSize in ProcessText and in UILabel.OnFill, check it see if the pixel density has changed and if it has, call ProcessText before doing the draw. Does that seem like a reasonable fix?

4
I think the material constructor is supposed to be :

new Material(Shader.Find("Unlit/Transparent Colored"));

otherwise it will actually try to compile that string into a shader.

Pages: [1]