Author Topic: FAQ: Frequently Asked Questions  (Read 65131 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
FAQ: Frequently Asked Questions
« on: April 11, 2012, 08:28:29 PM »
Quote
How do I use NGUI with Javascript?



Quote
What does this warning mean?
“Parent of “ABC” does not have a uniform absolute scale. Consider re-parenting to a uniformly-scaled game object instead.”

Scales of all parents leading up to your widgets must be (1, 1, 1), with the lone exception of UIRoot. If you do choose to scale something, do so uniformly — meaning all 3 scale dimensions (X, Y and Z) must have a matching value. For example: (0.25, 0.25, 0.25). This means you shouldn’t parent one widget to another. Parent them both to another game object instead.

Quote
In my project none of the mouse events seem to affect the UI. Why?

Edit -> Project Settings -> Physics
Raycast Hit Triggers [X] -– must be checked.

Quote
How to change the text of a label dynamically?
  1. UILabel lbl = GetComponent<UILabel>();
  2. lbl.text = "Hello World!";

I will be expanding this post with more questions and answers in the future.
« Last Edit: April 11, 2012, 08:38:33 PM by ArenMook »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: FAQ: Frequently Asked Questions
« Reply #1 on: April 17, 2012, 06:21:48 PM »
Quote
Why does my UI look so blurry when I hit Play?

Check the quality settings and make sure you're not on the "Fastest" setting. It reduces the texture size, resulting in blurriness.

Quote
Why do all the examples with a scroll view look messed up? Everything inside the scroll view looks like it's made out of colored squares!

Turn off GLES 1.1 emulation. GLES 1.1 disables shaders. Clipped panel-based scroll views need shaders in order to work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: FAQ: Frequently Asked Questions
« Reply #2 on: November 26, 2012, 12:30:19 AM »
Quote
Why is my stuff not getting clipped by my clipped panel?
1. Check to make sure that you have shaders turned on. This means NOT targeting GLES 1.1, and NOT having your quality set to Fastest.
2. Make sure that the atlas used by your widgets is using the Unlit/Transparent Colored shader. If you have Simple Textures (UITextures) in there, make sure that they too use this shader.
3. Make sure the clipped panel uses uniform scale: (1, 1, 1).
4. Your widgets that you want clipped must not have an extra panel in between of them and the clipped panel. Open the Panel Tool, select one of your widgets that should be clipped, and note which panel gets highlighted in the Panel Tool. If it's not your clipped panel, then you have an extra panel in there that you should remove.
5. Make sure that the shaders can be loaded properly. Did you move the NGUI's Resources folder somewhere?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: FAQ: Frequently Asked Questions
« Reply #3 on: February 04, 2013, 09:18:42 AM »
Quote
Destroying GameObjects immediately is not permitted during physics trigger/contact or animation event callbacks.
Don't disable/destroy anything in OnTriggerEnter() / OnCollisionEnter() functions. You can only do it in the main thread. Do this instead:
  1. void OnTriggerEnter() { StartCoroutine(DelayedDisable()); }
  2.  
  3. IEnumerator DelayedDisable() { <whatever you did in the OnTriggerEnter> }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: FAQ: Frequently Asked Questions
« Reply #4 on: May 01, 2014, 07:30:58 AM »
Quote
I get crashed or weird behaviour on Android!
Turn off "Multi-threaded rendering". It's a Unity bug: http://forum.unity3d.com/threads/211913-4-3-Multithreaded-rendering-crashes-when-running-on-device