Author Topic: NguiTools.Setactive work on editor but not on device.  (Read 3346 times)

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
NguiTools.Setactive work on editor but not on device.
« on: November 12, 2013, 03:22:18 PM »
Hello,

i'm creating a pause menu which suppose to appear  when i press the pause button and disappear when i press again.
for this i'm getting the widget container that hold my pause items and set it active\not active with:
  1. NGUITools.SetActive (MenuGui,showgui);
(when MenuGui hold the widget and showgui hold the bool state)

as the title said, it works fine in the editor but not on my android device.
any idea why?
any other way to achieve this?
and, if we are here, any known issues with Unity 4.3 that i need to be aware of?

thanks,

Haim.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NguiTools.Setactive work on editor but not on device.
« Reply #1 on: November 12, 2013, 03:35:15 PM »
The same code should work consistently everywhere, so you'll have to debug it further. I'm not aware of any issues with 4.3, although I haven't tested it on 4.3 in ~2 months. I know 4.5 works fine, for what it's worth! :)

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: NguiTools.Setactive work on editor but not on device.
« Reply #2 on: November 12, 2013, 03:40:40 PM »
"I know 4.5 works fine..." yahhh...just keep laughing to your self...  8) 8) 8)

any way, i will see what i will get from the device log but if i'm not getting any editor error not sure what can i do...

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: NguiTools.Setactive work on editor but not on device.
« Reply #3 on: November 12, 2013, 04:03:27 PM »
well, here the run time device log. you probably can't help without the full code but maybe you will have an idea...

this is the output when i press the pause button.
  1. 11-12 22:55:55.988: I/Unity(22617): NullReferenceException: Object reference not set to an instance of an object
  2. 11-12 22:55:55.988: I/Unity(22617):   at gamestate.pauseGame (Boolean doPause) [0x00000] in <filename unknown>:0
  3. 11-12 22:55:55.988: I/Unity(22617):   at LevelBuilder.PauseGameOpen () [0x00000] in <filename unknown>:0
  4. 11-12 22:55:55.988: I/Unity(22617):   at EventDelegate.Execute () [0x00000] in <filename unknown>:0
  5. 11-12 22:55:55.988: I/Unity(22617):   at EventDelegate.Execute (System.Collections.Generic.List`1 list) [0x00000] in <filename unknown>:0
  6. 11-12 22:55:55.988: I/Unity(22617):   at UIButton.OnClick () [0x00000] in <filename unknown>:0
  7. 11-12 22:55:55.988: I/Unity(22617): UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
  8. 11-12 22:55:55.988: I/Unity(22617): UICamera:Notify(GameObject, String, Object)
  9. 11-12 22:55:55.988: I/Unity(22617): UICamera:ProcessTouch(Boolean, Boolean)
  10. 11-12 22:55:55.988: I/Unity(22617): UICamera:ProcessTouches()
  11. 11-12 22:55:55.988: I/Unity(22617): UICamera:Update()
  12.  

i guess the problem start with the first line error: NullReferenceException: Object reference not set to an instance of an object
it works fine in the editor so i guess that same code should not work consistently everywhere.  :-\

any way, any other method to hide\show NGUI widgets?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NguiTools.Setactive work on editor but not on device.
« Reply #4 on: November 13, 2013, 05:03:17 AM »
What's the code of your gamestate.pauseGame that's causing it? It's a null ref, implying something you're using is null.

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: NguiTools.Setactive work on editor but not on device.
« Reply #5 on: November 13, 2013, 11:44:00 AM »
OK... found it!
i disabled these lines:
  1. GameHud.SetActive (true);
and
  1. GameHud.SetActive (true);
  2.  

the odd thing is that these also worked only on editor and not on the device.
and i'm not sure why it effected the NGUI panel.

whatever... thanks!!!