Author Topic: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8  (Read 14817 times)

Mastro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 8
    • View Profile
My Unity buttons worked fine, but when I added NGUI buttons, it worked fine in Unity testing it but when I deploy it to the Windows Phone 8, on a Nokia 1020 Lumnia, pressing an NGUI button crashes in the dev console window. Using nGui 3.6.0

See Attachment

Exception: Method not found: System.Reflection.MethodInfo
System.Type.GetMethod(System.String, system.Reflection.BindingFlags)

Type: System.MissingMethodException
Module: Assembly-CSharp
InnerException: <No Data>
AdditionalInfo:Invoking UIButton::OnClick method with argument count: 0
   at EventDelegate.Cache()
   at EventDelegate.Execute()
   at EventDelegate.Execute(List'1 list)
   at UIButton.OnClick()
   at lambda_method(Closure, object, object[], int32)
   at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[] args)

I've even tried a barebones project and still crashes.
« Last Edit: May 19, 2014, 10:18:11 PM by Mastro »

tkok

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #1 on: May 20, 2014, 04:54:35 AM »
Same problem here and I think it's not UIButton's broblem but EventDelegate's problem.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #2 on: May 20, 2014, 02:04:33 PM »
Crashes? I see two issues with this right off the bat... first, that code is in a try/catch block, so even if there was an exception it should just result in an error message. Second, the exception you are seeing is about a Type.GetMethod function, which his on line 368 -- and it's in an #if block that shouldn't get compiled on WSA/WP8 devices (NETFX_CORE). The WSA/WP8 changes were contributed by LoneCoder here:

http://www.tasharen.com/forum/index.php?topic=9509.msg44820#msg44820

If one of you wants to add me on Skype (arenmook) and test changes with me to get it working, I'd love to get to the bottom of this once and for all.

Mastro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 8
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #3 on: May 20, 2014, 05:18:55 PM »
Well it doesn't crash in exit the game but the error message shows up in the debug window. I'll send you private message to my source code. *Work in progress*

tkok

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #4 on: May 21, 2014, 05:23:59 AM »
If one of you wants to add me on Skype (arenmook) and test changes with me to get it working, I'd love to get to the bottom of this once and for all.

It doesn't crash, but shows Error when built with debugging to WP8. I can have Skype, but I'm currently in Malmö at Nordic Game Conference, I will be back at our office next week. Lets try Skype then if still necessary.

Lotti

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #5 on: May 21, 2014, 10:37:12 AM »
same exception here!

I added you (arenmoonk) to skype.

Mastro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 8
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #6 on: May 22, 2014, 09:40:29 AM »
Ok that sounds good. I'm out of town too till 5/24 anyway, so anytime next week works for me too.

LoneCoder

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 1
  • Posts: 9
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #7 on: May 22, 2014, 03:08:22 PM »
I think NETFX_CORE might only be defined for WSA, and not there for windows phone.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #8 on: May 22, 2014, 04:11:05 PM »
We found a solution yesterday that will be a part of the next update.

gigakaiser

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #9 on: May 24, 2014, 10:09:55 PM »
ETA of update?

gigakaiser

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #10 on: May 24, 2014, 10:10:47 PM »
nevermind!

Lotti

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #11 on: June 09, 2014, 05:28:00 AM »
Uff! it appears again on a new game :\ i updated to latest ngui 3.6.3. message me on skype when you can investigate to fix this issue!

  1. Exception: Method not found: 'System.Reflection.MethodInfo System.Type.GetMethod(System.String, System.Reflection.BindingFlags)'.
  2. Type: System.MissingMethodException
  3. Module: Assembly-CSharp
  4. InnerException: <No Data>
  5. AdditionalInfo:Invoking UIEventTrigger::OnClick method with argument count: 0
  6.    at EventDelegate.Cache()
  7.    at EventDelegate.Execute()
  8.    at EventDelegate.Execute(List`1 list)
  9.    at UIEventTrigger.OnClick()
  10.    at lambda_method(Closure , Object , Object[] , Int32 )
  11.    at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[] args)
  12.  
  13. (Filename: C:/BuildAgent/work/d3d49558e4d408f4/Runtime/Scripting/WinRTUtility.cpp Line: 65)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ngui 3.6.0 UIButton doesn't seem to work on Windows Phone 8
« Reply #12 on: June 10, 2014, 02:04:14 AM »
This is the code used right now:
  1. #if UNITY_WP8
  2.                                                 mMethod = type.GetMethod(mMethodName);
  3.                                                 if (mMethod == null)
  4. #endif
  5.                                                 mMethod = type.GetMethod(mMethodName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  6.                                                 if (mMethod != null) break;
I basically need someone with a WP8 device to figure out what actually works properly. I heard conflicting reports here. Before it was just "mMethod = type.GetMethod(mMethodName);", but this doesn't pick up non-public functions. Someone else said that the second approach (with binding flags) actually works yet even though the two people who helped me test proved that it doesn't. So I don't know what to believe. Also the way it is right now, the second call, with the binding flags, shouldn't even be getting called if the first one succeeds -- so again, why is it being called and what's going on? I need someone with a WP8 device to examine this part of EventDelegate.cs on line 358 and find a proper solution.