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 - beyonddoor

Pages: [1]
1
Here comes the new situation, when the font's displaying wired, I enlarge the font texture by RequestCharactersInTexture, when the texture size changed, the texture becomes normal now. still don't know what the cause and how to fix it

2
My game is developed by Unity 4.6 and NGUI, the fonts are dynamic fonts to support Asian characters, but at some Android devices the fonts failed to display properly, characters became solid blocks.


I have tried to render the font texture, the UIFont.texture is defined as

  1. public Texture2D texture
  2.     {
  3.         get
  4.         {
  5.             if (mReplacement != null) return mReplacement.texture;
  6.             Material mat = material;
  7.             return (mat != null) ? mat.mainTexture as Texture2D : null;
  8.         }
  9.     }

and property material is mDynamicFont.material, the rendering result is a solid black rectangle.

Font texture size is 512x1024, and the uv of CharacterInfo is valid, so I dont know why font texture became so wired and how to fix it.

3
Curious suggestion.. thanks. Just note though that this only happens in the Editor, so it's not much of an issue in practice.
Oh, my fault,  :-[, I test my game in Editor with profiler, and neglect the UNITY_EDITOR macro. Thanks to point it out.

4
NGUI 3 Support / The best way to hide/show UIWidget?
« on: May 03, 2016, 08:16:48 AM »
UIPanel.LateUpdate is invoked too often in my game, I found hide an UIWidget by GameObject.SetActive(false) will force the UIPanel to rebuild itself, So I have the following methods:
  • set alpha to zero
  • set localScale to zero
  • move to a invisible position out of camera
The method 2 and method 3 works as expected, both make UpdateGeometry called less often, but I want to know the best way to hide and show UIWidget (and widgets in its children), any advise is appreciated, thanks

5
Hi, I really like NGUI, here's a little improvement.
  1.         Vector2 GetWindowSize ()
  2.         {
  3.                 UIRoot rt = root;
  4. #if UNITY_EDITOR
  5.                 Vector2 size = GetMainGameViewSize();
  6.                 if (rt != null) size *= rt.GetPixelSizeAdjustment(Mathf.RoundToInt(size.y));
  7. #else
  8.                 Vector2 size = new Vector2(Screen.width, Screen.height);
  9.                 if (rt != null) size *= rt.GetPixelSizeAdjustment(Screen.height);
  10. #endif
  11.                 return size;
  12.         }
  13.  
  14.         static public Vector2 GetMainGameViewSize ()
  15.         {
  16.                 int frame = Time.frameCount;
  17.                 if (mSizeFrame != frame)
  18.                 {
  19.                         mSizeFrame = frame;
  20.                         if (s_GetSizeOfMainGameView == null)
  21.                         {
  22.                                 System.Type type = System.Type.GetType("UnityEditor.GameView,UnityEditor");
  23.                                 s_GetSizeOfMainGameView = type.GetMethod("GetSizeOfMainGameView",
  24.                                         System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
  25.                         }
  26.                         mGameSize = (Vector2)s_GetSizeOfMainGameView.Invoke(null, null);
  27.                 }
  28.                 return mGameSize;
  29.         }
  30.  
here s_GetSizeOfMainGameView is System.Reflection.MethodInfo type in UIPanel, which can be replaced by Func<Vector2>, as the following, which will not alloc extra memory.

  1. s_GetSizeOfMainGameView = (Func<Vector2>)Delegate.CreateDelegate(typeof(Func<Vector2>), methodInfo);
  2.  

6
Hi, all!
In my game, each UI frame is attached a camera for convenience , so here comes the problem, when an UIRect is enabled, ResetAnchors is called in its Update, in UIRect.cs.
  1. mMyCam = NGUITools.FindCameraForLayer(cachedGameObject.layer);

Actually, mMyCam is assigned to another frame's camera, thus the rect is totally wrong. Please help me to solve it.
ps, my currently used NGUI is 3.4.9.

Pages: [1]