Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: roady on September 04, 2015, 11:00:47 AM

Title: NGUIText.Prepare crash iOS
Post by: roady on September 04, 2015, 11:00:47 AM
Unity 5.1.3p2
NGUI 3.9.2

Having issue that started to appear on iOS, not in Unity Editor. Any advice?
As you can see in the log the txtScore is set.

iOS Crash
-----------

set #1
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

   val txt Score (UILabel)
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

NullReferenceException: A null value was found where an object instance was required.
  at NGUIText.Prepare (System.String text) [0x00000] in <filename unknown>:0
  at UILabel.ProcessText (Boolean legacyMode, Boolean full) [0x00000] in <filename unknown>:0
  at UILabel.set_text (System.String value) [0x00000] in <filename unknown>:0
  at ScreenScore+<ShowNow>c__Iterator28.MoveNext () [0x00000] in <filename unknown>:0


Unity Code: ScreenScore.cs
------------
Debug.Log ("set #1");
Debug.Log ("   val "+ txtScore);
txtScore.text = "0";   <!-- seems to be crashing here
Debug.Log ("set #2 "+txtScoreTop);
txtScoreTop.text = "0";
Title: Re: NGUIText.Prepare crash iOS
Post by: ArenMook on September 06, 2015, 05:37:34 PM
What's "txtScore"? First you seem to output it like a value (Debug.Log("  val " + txtScore);, then you try to use it as a label (txtScore.text). So which is it?
Title: Re: NGUIText.Prepare crash iOS
Post by: roady on September 11, 2015, 06:20:12 AM

public UILabel txtScore;

Is connected thru Unity GUI.

When removing the line txtScore.text = "0"; it works all the time.
Title: Re: NGUIText.Prepare crash iOS
Post by: mdeletrain on September 11, 2015, 09:37:54 AM
I think this is the same bug as http://www.tasharen.com/forum/index.php?topic=13479.0