Author Topic: NGUI and Flash  (Read 5110 times)

tng2903

  • Guest
NGUI and Flash
« on: December 09, 2013, 01:50:24 AM »
Hi,

I know that this topic is old, and Flash is dying, but as a developer, I must follow the leader, so please help me with this issue, since I don't know what to do next.

I'm using NGUI 3.0.6 f7, when I tried to build Flash version, Unity give me 2 error (everything else is fine, compile ok, can run smoothly in Editor, but just can't build into swf)

The first error:
  1. Failed to convert type 'NGUITools': Failed to resolve T
  2. Mono.Cecil.ResolutionException: Failed to resolve T
  3.   at Unity.CecilTools.Extensions.ResolutionExtensions.Resolve[TypeReference,TypeDefinition] (Mono.Cecil.TypeReference reference, System.Func`2 resolve) [0x00000] in <filename unknown>:0
  4.   at Unity.CecilTools.Extensions.ResolutionExtensions.CheckedResolve (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0
  5.   at Unity.CecilTools.Extensions.TypeReferenceExtensions.IsAssignableTo (Mono.Cecil.TypeReference typeRef, System.String typeName) [0x00000] in <filename unknown>:0
  6.   at cil2as.Extensions.TypeReferenceExtensions.IsDelegate (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0
  7.   at cil2as.Decompiler.Transforms.OptimizeCasts.RequiresCastAs (ICSharpCode.NRefactory.CSharp.AstType type) [0x00000] in <filename unknown>:0
  8.   at cil2as.Decompiler.Transforms.OptimizeCasts.VisitCastExpression (ICSharpCode.NRefactory.CSharp.CastExpression castExpression, System.Object data) [0x00000] in <filename unknown>:0

Please note that there are a lot more of <filename unknown> below this point, but I truncated them for short :D


The second error:
  1. Error building Player: Exception: C:/Program Files (x86)/Unity/Editor/Data/PlaybackEngines/FlashSupport\BuildTools\cil2as\cil2as.exe Failed:
  2.  
  3. ERROR: Failed to convert type 'NGUITools': Failed to resolve T
  4. Mono.Cecil.ResolutionException: Failed to resolve T
  5.   at Unity.CecilTools.Extensions.ResolutionExtensions.Resolve[TypeReference,TypeDefinition] (Mono.Cecil.TypeReference reference, System.Func`2 resolve) [0x00000] in <filename unknown>:0
  6.   at Unity.CecilTools.Extensions.ResolutionExtensions.CheckedResolve (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0
  7.   at Unity.CecilTools.Extensions.TypeReferenceExtensions.IsAssignableTo (Mono.Cecil.TypeReference typeRef, System.String typeName) [0x00000] in <filename unknown>:0
  8.   at cil2as.Extensions.TypeReferenceExtensions.IsDelegate (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0
  9.   at cil2as.Decompiler.Transforms.OptimizeCasts.RequiresCastAs (ICSharpCode.NRefactory.CSharp.AstType type) [0x00000] in <filename unknown>:0
  10.   at cil2as.Decompiler.Transforms.OptimizeCasts.VisitCastExpression (ICSharpCode.NRefactory.CSharp.CastExpression castExpression, System.Object data) [0x00000] in <filename unknown>:0
  11.  


Before reaching this point, I must make some modification in NGUI's classes: UIDrawCall.cs, NGUIText.cs and BetterList.cs

As I search for answer, I encounter something similar happened in NGUI 2.6.2, in NGUITools also. But as I tried to apply the fix mentioned, I can't seem to get it to work.

Thank you so much for this amazing foundation


EDIT: I forgot to mention, I'm using Unity 4.2.1 at work, but I've tried with Unity 4.3 with no success


EDIT 2: I tried to build NGUI's examples for testing purpose :D, since I want a solid starting point :D

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Re: NGUI and Flash
« Reply #1 on: December 09, 2013, 04:08:29 AM »
i am interested in this too!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI and Flash
« Reply #2 on: December 09, 2013, 07:42:32 AM »
Just comment out the FindAll() function and it seems to work fine. It's not used anywhere in NGUI 3.0.7, so it's safe to remove. In fact, I am going to do just that and put up an update...

tng2903

  • Guest
Re: NGUI and Flash
« Reply #3 on: December 09, 2013, 11:01:05 AM »
Hi,

Do you mean the FindAll<T>() function in NGUITools class? Because when I try to comment it out, there is some other function using it: NormalizeWidgetDepths() and NormalizePanelDepths() for instance.

I don't know what is wrong with the FindAll, or why it don't compile for flash. Would you mind sharing these information ?

Thank you for your help ^^

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI and Flash
« Reply #4 on: December 09, 2013, 01:13:21 PM »
3.0.7 f1 is already out and it compiles fine on flash. Just grab the latest.

tng2903

  • Guest
Re: NGUI and Flash
« Reply #5 on: December 11, 2013, 02:49:56 AM »
Thank you for the information, I've just updated NGUI and every thing is fine now. :D