coolboy1/dotween

Add WebGL support

Closed this issue · 6 comments

Exporting A DOTween test with Webgl exporter un Unity 5.0.0b1 gives the 
following non informative errors:

Error1:

stdout:
stderr:

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an 
object

  at Unity.IL2CPP.Extensions.IsValueType (Mono.Cecil.TypeReference typeReference) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.Emit.Box (Mono.Cecil.TypeReference type, System.String value) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.MethodWriter.WriteMethodInvokerIfNeeded (Mono.Cecil.MethodDefinition method, MethodWriteMode mode) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.MethodWriter.WriteMethodAndWrappers (Mono.Cecil.MethodReference method, MethodWriteMode mode) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.MethodWriter.WriteMethodDefinitions (System.Func`2 filter) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteMethodDefinitionsFor (Unity.IL2CPP.CppCodeWriter writer, System.Func`2 filter, Mono.Cecil.TypeReference type, Unity.IL2CPP.Metadata.VTableBuilder vTableBuilder, Unity.IL2CPP.DelegateSupport delegateSupport, Mono.Cecil.AssemblyDefinition mscorlib) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteSource (Unity.IL2CPP.CppCodeWriter writer, Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteSourceFiles (System.String outputDirectory, System.String fileName, Mono.Cecil.TypeReference[] typeList) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteGenerics (Unity.IL2CPP.GenericsCollection.InflatedCollection genericsCollection) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.AssemblyConverter.WriteGenerics () [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.AssemblyConverter.Apply () [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies (System.String[] assemblies, System.String outputDir, IInternalCallVerifier internalCallVerifier) [0x00000] in <filename unknown>:0 

  at il2cpp.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object 
reference not set to an instance of an object

  at Unity.IL2CPP.Extensions.IsValueType (Mono.Cecil.TypeReference typeReference) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.Emit.Box (Mono.Cecil.TypeReference type, System.String value) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.MethodWriter.WriteMethodInvokerIfNeeded (Mono.Cecil.MethodDefinition method, MethodWriteMode mode) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.MethodWriter.WriteMethodAndWrappers (Mono.Cecil.MethodReference method, MethodWriteMode mode) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.MethodWriter.WriteMethodDefinitions (System.Func`2 filter) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteMethodDefinitionsFor (Unity.IL2CPP.CppCodeWriter writer, System.Func`2 filter, Mono.Cecil.TypeReference type, Unity.IL2CPP.Metadata.VTableBuilder vTableBuilder, Unity.IL2CPP.DelegateSupport delegateSupport, Mono.Cecil.AssemblyDefinition mscorlib) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteSource (Unity.IL2CPP.CppCodeWriter writer, Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteSourceFiles (System.String outputDirectory, System.String fileName, Mono.Cecil.TypeReference[] typeList) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.SourceWriter.WriteGenerics (Unity.IL2CPP.GenericsCollection.InflatedCollection genericsCollection) [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.AssemblyConverter.WriteGenerics () [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.AssemblyConverter.Apply () [0x00000] in <filename unknown>:0 

  at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies (System.String[] assemblies, System.String outputDir, IInternalCallVerifier internalCallVerifier) [0x00000] in <filename unknown>:0 

  at il2cpp.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

UnityEngine.Debug:Log(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String) (at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:47)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection`1, String) 
(at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:377)
UnityEditorInternal.IL2CPPBuilder:Run() (at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:258)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, 
Action`1, RuntimeClassRegistry) (at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:198)
UnityEditor.HostView:OnGUI()


Error 2:

--build-format=Bulk --copy-level=None "C:\Users\Fer\Desktop\tempunity2\New 
Unity Project 1\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll" 
"C:\Users\Fer\Desktop\tempunity2\New Unity Project 
1\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll" 
"C:\Users\Fer\Desktop\tempunity2\New Unity Project 
1\Temp\StagingArea\Data\il2cppOutput" 
UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String) (at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:48)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection`1, String) 
(at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:377)
UnityEditorInternal.IL2CPPBuilder:Run() (at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:258)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, 
Action`1, RuntimeClassRegistry) (at 
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:198)
UnityEditor.HostView:OnGUI()

Error 3:

Error building Player: Exception: C:/Program Files/Unity 
5.0.0b1/Editor/Data\PlaybackEngines\webglsupport/BuildTools\il2cpp/il2cpp.exe 
did not run properly!


Original issue reported on code.google.com by fer...@gmail.com on 23 Aug 2014 at 4:56

Tested with the current version of DoTween and with the last test version in 
the Flash support issue, the same happens.

Original comment by fer...@gmail.com on 23 Aug 2014 at 4:58

Thanks for the output, which is indeed quite messy. I'm leaving it to medium 
priority because all these errors seem due to IL2CPP being a terrible mess 
right now (which we knew would happen, at least initially), so I'll wait and 
see how they develop it in the near future. Should it still be a terrible mess 
when Unity 5 will be out, I'll start sending bug reports and working on 
parallel :P

Original comment by daniele....@gmail.com on 23 Aug 2014 at 6:02

  • Changed state: Accepted
[deleted comment]
Are you using Linq or another dependece that has extension methods? because I 
was investigating a lot, and I managed to replicate the error, it seems that 
the only non supported feature is extension methods. I've made 2 assets 
compatible with webgl only changin extension methods to static methods and 
replacing Linq.

I know you don't want to add Webgl support for the moment, so can you tell me 
how to compile the dll of HOTween or what to read to lern that? maybe you know 
a good tutorial, I've never compilled a DLL before. I want to release a non 
oficial version with the support.

Original comment by fer...@gmail.com on 25 Aug 2014 at 1:58

No Linq, both because I know it can cause compatibility issues and because it's 
slow (for a tween engine at least, where I use every possible trick to achieve 
a better performance).
Instead I use a lot of extension methods, both because without them there would 
be no shortcuts and because they allow to keep the actual tween classes much 
lighter.

If the problem is just extension methods that is actually good. Extension 
methods are just syntactic sugar, and I'm sure Unity will implement them before 
WebGL comes out of alpha (also because they directly show how to use them in 
their tutorials: 
http://unity3d.com/learn/tutorials/modules/intermediate/scripting/extension-meth
ods).

About compiling a DLL it's pretty easy. Just download the trunk (you only need 
the DOTween folder and the "DOTween.sln" file) and open the solution file with 
Visual Studio or MonoDevelop. Everything is already setup for a build, except 
you'll probably A) want to change the Build Events (in the corresponding tab of 
DOTween's project properties in VS - I don't think MonoDevelop has them so you 
can just ignore them), B) change the UnityEngine reference to where your 
UnityEngine.dll is to be found. After that you can just press build.

*About releasing a not official version* instead, *please don't do that*. You 
can modify it for personal usage, but I have to ask you not to redistribute it.

Original comment by daniele....@gmail.com on 25 Aug 2014 at 11:27

  • Changed title: Add WebGL support
With the latest Unity 5 beta it finally works. Big kudos to #fermmm for pushing 
Unity to fix all issues.

Original comment by daniele....@gmail.com on 21 Nov 2014 at 5:35

  • Changed state: Fixed