Author Topic: NGUIText.Prepare crash iOS  (Read 7402 times)

roady

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 30
    • View Profile
NGUIText.Prepare crash iOS
« 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";

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUIText.Prepare crash iOS
« Reply #1 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?

roady

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: NGUIText.Prepare crash iOS
« Reply #2 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.

mdeletrain

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 71
    • View Profile
Re: NGUIText.Prepare crash iOS
« Reply #3 on: September 11, 2015, 09:37:54 AM »