Author Topic: Unity 4.2 beta NGUI dynamic fonts not displaying non latin characters in metro  (Read 15024 times)

stephan7

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Hi everyone,

Regarding the error CS1061: 'EventDelegate.Callback' does not contain a definition for 'Method' mentioned above:

I solved it temporarily with a quick hack by writing a minimalistic plugin for WinRT.

The WinRT plugin has the following method:
public static string GetMethodName(Object callback)
{
    Delegate d = callback as Delegate;
    return d.GetMethodInfo().Name;
}


In the standard plugin for Non-WinRT builds this method looks like:
public static string GetMethodName(Object callback)
{
   Delegate d = callback as Delegate;
   return d.Method.Name;
}


Depending on whether you are making a build for WinRT or another platform Unity is automatically choosing the correct plugin.

BTW: one can't work with a conditional compile because GetMethodInfo() is not recognized by Unity's transformation from Mono to WinRT's .Net.

Perhaps that's useful for the one or other NGUI user.


baptiste39100

  • Guest
Hi,

stephan7 can you share your dll please, i can't compile a plugin there is no "blanck solution" available in my vs studio and i haven't fnd a solution yet....

stephan7

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile

stephan7 can you share your dll please, i can't compile a plugin there is no "blanck solution" available in my vs studio and i haven't fnd a solution yet....


There is an even simpler solution available that requires no plugin.

    private void ShowInfoAboutCurrentCallback()
    {
#if !UNITY_EDITOR && UNITY_METRO
        Debug.Log(callback.GetMethodInfo().Name);
#else
        Debug.Log (callback.Method.Name);
#endif
    }

On all other platforms it seems, that Unity supplies it's customized mono implementation. But not on WinRT.

Hope this helps,

Stephan
--
http://www.software7.com

blu3wings

  • Guest
Hi everyone,

Regarding the error CS1061: 'EventDelegate.Callback' does not contain a definition for 'Method' mentioned above:

I solved it temporarily with a quick hack by writing a minimalistic plugin for WinRT.

The WinRT plugin has the following method:
public static string GetMethodName(Object callback)
{
    Delegate d = callback as Delegate;
    return d.GetMethodInfo().Name;
}


In the standard plugin for Non-WinRT builds this method looks like:
public static string GetMethodName(Object callback)
{
   Delegate d = callback as Delegate;
   return d.Method.Name;
}


Depending on whether you are making a build for WinRT or another platform Unity is automatically choosing the correct plugin.

BTW: one can't work with a conditional compile because GetMethodInfo() is not recognized by Unity's transformation from Mono to WinRT's .Net.

Perhaps that's useful for the one or other NGUI user.



Nope. Not working for me. I tried Method an GetMethodInfo(). I can't compile for Metro. Am I missing anything here?

Filimindji

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Hi there,

This is a solution that work for PC, Windows Store App and Windows Phone 8 - at least for me :

  1.  
  2. #if UNITY_EDITOR || (!UNITY_FLASH && !UNITY_WP8 && !UNITY_METRO)
  3. #define REFLECTION_SUPPORT
  4. #endif
  5.  
  6. // no #if before
  7. using System.Reflection;
  8.  
  9.  

...

  1.  
  2. #if !UNITY_EDITOR && UNITY_WP8
  3.     static string GetMethodName (Callback callback)
  4.     {
  5.         System.Delegate d = callback as System.Delegate;
  6.         return d.Method.Name;
  7.     }
  8.  
  9.     static bool IsValid (Callback callback)
  10.     {
  11.         System.Delegate d = callback as System.Delegate;
  12.         return d != null && d.Method != null;
  13.     }
  14. #elif !UNITY_EDITOR && UNITY_METRO
  15.     static string GetMethodName (Callback callback)
  16.     {
  17.         System.Delegate d = callback as System.Delegate;
  18.         return d.GetMethodInfo().Name;
  19.     }
  20.  
  21.     static bool IsValid (Callback callback)
  22.     {
  23.         System.Delegate d = callback as System.Delegate;
  24.         return d != null && d.GetMethodInfo() != null;
  25.     }
  26. #else
  27.  
  28.     // Perhaps it can be improved by merging this with the first #if
  29.     // I will let you try that ;)
  30.  
  31.     static string GetMethodName (Callback callback) { return callback.Method.Name; }
  32.     static bool IsValid (Callback callback) { return callback != null && callback.Method != null; }
  33. #endif
  34.  
  35.  

Well, I can't test for WP8 because I have no device, but it compile without error.

Let me know if it helps.
« Last Edit: November 03, 2013, 08:03:15 AM by Filimindji »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
So Win8 is different from Windows Phone 8. Makes sense. Not. Someone derped this one.

stephan7

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
The WinRT and WP8 API have the same ancestor, but they have surprisingly significant differences.