Search Unity

Unity 5.1 UNetWeaver errors.

Discussion in 'UNet' started by derkoi, Jun 10, 2015.

  1. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Hi, I've just upgraded my project to Unity 5.1 and I'm getting the following errors:

    Anyone know of a fix? I can't submit a bug report as my project is too big.
     
  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    This is a bug (701313) caused by UNetWeaver processing Editor scripts when it should not be. The fix for this will be in an upcoming patch release (probably 5.1p2 as 5.1p1 is in 2 days).
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068
    @Meceka found a way to work around this bug. Until the patch release, please

     
  4. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
  5. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    @tobiass I don't have Photon in my project. If you look, my error is not a null reference.
     
  6. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068
    @derkoi: Sorry, my fault. I thought it's related but I mixed up topics, apparently.
     
  7. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    hi
    im getting same errors after upgrading to unity 5.1.0f3 today. No photon in my project either...

    UNetWeaver error: Exception :System.ArgumentException: An element with the same key already exists in the dictionary.
    at System.Collections.Generic.Dictionary`2[System.UInt32,System.UInt32].Add (UInt32 key, UInt32 value) [0x0007e] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404
    at Mono.Cecil.MetadataSystem.SetReverseNestedTypeMapping (UInt32 nested, UInt32 declaring) [0x00000] in <filename unknown>:0
    at Mono.Cecil.MetadataReader.AddNestedMapping (UInt32 declaring, UInt32 nested) [0x00000] in <filename unknown>:0
    at Mono.Cecil.MetadataReader.InitializeNestedTypes () [0x00000] in <filename unknown>:0
    at Mono.Cecil.MetadataReader.InitializeTypeDefinitions () [0x00000] in <filename unknown>:0
    at Mono.Cecil.MetadataReader.ReadTypes () [0x00000] in <filename unknown>:0
    at Mono.Cecil.ModuleDefinition.<get_Types>b__8 (Mono.Cecil.ModuleDefinition _, Mono.Cecil.MetadataReader reader) [0x00000] in <filename unknown>:0
    at Mono.Cecil.ModuleDefinition.Read[ModuleDefinition,TypeDefinitionCollection] (Mono.Cecil.ModuleDefinition item, System.Func`3 read) [0x00000] in <filename unknown>:0
    at Mono.Cecil.ModuleDefinition.get_Types () [0x00000] in <filename unknown>:0
    at Unity.UNetWeaver.Weaver.Weave (System.String assName, IEnumerable`1 dependencies, System.String unityEngineDLLPath, System.String unityUNetDLLPath, System.String outputDir) [0x00049] in /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1455
    at Unity.UNetWeaver.Weaver.WeaveAssemblies (IEnumerable`1 assemblies, IEnumerable`1 dependencies, System.String outputDir, System.String unityEngineDLLPath, System.String unityUNetDLLPath) [0x00060] in /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1531
    UnityEngine.Debug:LogError(Object)
    Unity.UNetWeaver.Log:Error(String) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:19)
    Unity.UNetWeaver.Weaver:WeaveAssemblies(IEnumerable`1, IEnumerable`1, String, String, String) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1538)
    Unity.UNetWeaver.Program:process(String, String, String, String[], String[], Action`1, Action`1) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:33)
    UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)


    Failure generating network code.
    UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)


    This happens when i import a package (seems any package) from the asset store, i tried with 'master audio' and 'skele' so far both with same errors. if i delete packages errors go.

    any fix for this?

    cheers.
     
  8. Arberk

    Arberk

    Joined:
    Feb 3, 2014
    Posts:
    5
    Try to remove (rename/move) folder with networking extension (if you don't use this new feature)
    <PathToUnity>\Editor\Data\UnityExtensions\Unity\Networking

    Or wait upcoming patch :)
     
    nife and radimoto like this.
  9. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    I upgraded to 5.1.1f1 today and still get the following error:

    UNetWeaver error: Exception :System.ArgumentException: An element with the same key already exists in the dictionary.

    Following @Arberk above (on Mac OS X 10.10.3), I went into Unity.app > Contents > UnityExtensions > Unity and moved the Networking folder onto my Desktop. I now get the following error when Unity starts up:

    Exception generating network code: System.Exception: dll could not be located at /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll!

    All is good though - my project now compiles and I can play the game again. I'm not using UNET yet so happy to just be able to work on this project again. Cheers! :)
     
  10. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    same here, i upgraded to 5.1.1f1 today but im still getting the errors as well. I also used the above solution and still get the errors, but can now compile my game.

    looking forward to the fix for this.
     
  11. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    I tried Unity v5.1.1 p1 and completely reimported my project.

    I'm getting a new error now but my old one hasn't appeared yet..

    If I delete the Networking folder as suggested above I can play my game in the editor but I can't build it. :(
     
  12. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    I updated to 5.1.1p2 and just got this error. Stopped my project cold. Anyone have luck?
     
  13. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    What I ended up doing was deleting a lot of packages from my project that I wasn't using whilst Unity was closed and reimported everything & the error went away. I have no idea which package was causing the issue.
     
  14. Itchy-Games

    Itchy-Games

    Joined:
    Jul 8, 2009
    Posts:
    221
    I'm Using Unity 5.1.21f and de issue still there... any news about it? (it happens on Mac OSX 10.9.5).
     
  15. meat5000

    meat5000

    Joined:
    Mar 5, 2013
    Posts:
    118
    5.1.2f1

    I take the SyncVar off my List temporarily to help it compile then this happens :

    This new version is throwing out lots of errors on things it was perfectly happy with in 5.1.1f1. There's even an error in the error....

    "You cannot pass a Compent to a Command".

    I fixed the second error by not passing a transform in to my @Command function but grabbed it from a global variable instead.

    EDIT: Damned smileys in the quote! Bit annoying.
     
    Last edited: Jul 29, 2015
  16. Anubis75

    Anubis75

    Joined:
    Jul 29, 2013
    Posts:
    24
    i had the same problem in 5.1.2f1.
    In My case change a variable from private Text text; to [SyncVar] private Text text;, after change back, the problem was no more exist

    PS:
    using System;
    using UnityEngine;
    using UnityEngine.UI;
    using System.Collections;
    using UnityEngine.Networking;
     
    Last edited: Aug 9, 2015
  17. Chrispins

    Chrispins

    Joined:
    Dec 9, 2014
    Posts:
    15
    I am on version 5.3.1f1 and I also have a similar error on my UNet multiplayer enabled game. This error occurs randomly after 5 or so minutes when playing in a matchmaker hosted game, and causes the match to completely timeout.

    Error message:
    ArgumentException: An element with the same key already exists in the dictionary.
    System.Collections.Generic.Dictionary`2[UnityEngine.Networking.Types.NetworkID,UnityEngine.Networking.Types.NetworkAccessToken].Add (NetworkID key, UnityEngine.Networking.Types.NetworkAccessToken value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:453)
    UnityEngine.Networking.Utility.SetAccessTokenForNetwork (NetworkID netId, UnityEngine.Networking.Types.NetworkAccessToken accessToken) (at C:/buildslave/unity/build/Runtime/Networking/Managed/UNETTypes.cs:119)
    UnityEngine.Networking.NetworkManager.OnMatchJoined (UnityEngine.Networking.Match.JoinMatchResponse matchInfo) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkManager.cs:1209)
    UnityEngine.Networking.Match.NetworkMatch+<ProcessMatchResponse>c__Iterator0`1[UnityEngine.Networking.Match.JoinMatchResponse].MoveNext () (at C:/buildslave/unity/build/Runtime/Networking/Managed/MatchMakingClient.cs:302)

    I haven't read this entire thread yet, but I really hope they are going to address this problem soon!
     
  18. bitbiome_llc

    bitbiome_llc

    Joined:
    Aug 3, 2015
    Posts:
    58
    Just moved from 5.2.3f1 to 5.3.1f1 and my project throws the following error in the editor. Can't launch my game and monodevelop shows no errors.

    I just installed 5.3.1p3 and still get the same errors.

    Update and Solution
    Again, it was my own problem. I was somehow passing a custom argument type for a remote action. Not sure how this didn't throw an error before. If you do happen to have a similar error check your remote action Cmd and Rpc methods for unsupported argument types.

    Relevant Documentation
    http://docs.unity3d.com/Manual/UNetActions.html



    UNetWeaver error: WriteReadFunc for itemRefs [System.Collections.Generic.List`1<System.String>/System.Collections.Generic.List`1<System.String>]. Cannot have generic parameters.
    UnityEngine.Debug:LogError(Object)
    Unity.UNetWeaver.Log:Error(String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:20)
    Unity.UNetWeaver.Weaver:GenerateWriterFunction(TypeReference) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:587)
    Unity.UNetWeaver.Weaver:GetWriteFunc(TypeReference) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:290)
    Unity.UNetWeaver.NetworkBehaviourProcessor:WriteArguments(ILProcessor, MethodDefinition, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:136)
    Unity.UNetWeaver.NetworkBehaviourProcessor:processCommandCall(MethodDefinition, CustomAttribute) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:1074)
    Unity.UNetWeaver.NetworkBehaviourProcessor:processMethods() (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:1297)
    Unity.UNetWeaver.NetworkBehaviourProcessor:process() (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:54)
    Unity.UNetWeaver.Weaver:processNetworkBehaviourType(TypeDefinition) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1074)
    Unity.UNetWeaver.Weaver:CheckNetworkBehaviour(TypeDefinition) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1558)
    Unity.UNetWeaver.Weaver:Weave(String, IEnumerable`1, IAssemblyResolver, String, String, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1667)
    Unity.UNetWeaver.Weaver:WeaveAssemblies(IEnumerable`1, IEnumerable`1, IAssemblyResolver, String, String, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1757)
    Unity.UNetWeaver.Program:process(String, String, String, String[], String[], IAssemblyResolver, Action`1, Action`1) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:34)
    UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)



    UNetWeaver error: WriteArguments for CmdAddPlayerToServer type Character not supported
    UnityEngine.Debug:LogError(Object)
    Unity.UNetWeaver.Log:Error(String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:20)
    Unity.UNetWeaver.NetworkBehaviourProcessor:WriteArguments(ILProcessor, MethodDefinition, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:139)
    Unity.UNetWeaver.NetworkBehaviourProcessor:processCommandCall(MethodDefinition, CustomAttribute) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:1074)
    Unity.UNetWeaver.NetworkBehaviourProcessor:processMethods() (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:1297)
    Unity.UNetWeaver.NetworkBehaviourProcessor:process() (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:54)
    Unity.UNetWeaver.Weaver:processNetworkBehaviourType(TypeDefinition) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1074)
    Unity.UNetWeaver.Weaver:CheckNetworkBehaviour(TypeDefinition) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1558)
    Unity.UNetWeaver.Weaver:Weave(String, IEnumerable`1, IAssemblyResolver, String, String, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1667)
    Unity.UNetWeaver.Weaver:WeaveAssemblies(IEnumerable`1, IEnumerable`1, IAssemblyResolver, String, String, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1757)
    Unity.UNetWeaver.Program:process(String, String, String, String[], String[], IAssemblyResolver, Action`1, Action`1) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:34)
    UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)



    Failure generating network code.
    UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)
     
    Last edited: Jan 20, 2016
    Thoiar likes this.
  19. timothyallan

    timothyallan

    Joined:
    May 22, 2013
    Posts:
    72
    I'm getting this as well with the new 5.3.1p4 on a brand new project after importing Grids Pro 1.14.2 :S
     
  20. Grislymanor

    Grislymanor

    Joined:
    Aug 15, 2014
    Posts:
    23
    I downloaded 5.1.2f1 and it allowed me to not include "networking" libraries in the plug-in I couldn't get to compile and no error! It appears that any version new than 5.1.2 f1 doesn't give you the opportunity to un-select networking. Try it!
     
  21. IndieGa

    IndieGa

    Joined:
    Jan 21, 2016
    Posts:
    1
    We had the same error, and it is really a compiler error. We found that if the Assembly-CSharp.dll larger than 1 MB is not possible to read it. That is, when the amount of code that is greater than a threshold, the library is compiled crooked. So now we use this https://bitbucket.org/alexzzzz/unity-c-5.0-and-6.0-integration/overview. Eeverything works fine. I hope this helps someone. Good luck!
     
  22. donmetapod

    donmetapod

    Joined:
    Jul 26, 2013
    Posts:
    3
    I did find a really simple solution that works every time, I don't know exactly why this problem happens but it is caused by a script that gets "damage" in some way, in my case I found that a script called UIManager was causing the error (this was the last script I worked on before the error appear) so the only thing I needed to do is create a new script called MyUIManager, copy-paste the contents of UIManager into this script and delete the UIManager script.

    I found the issue on unity version 5.3.2 and version 5.3.3.
     
    DmitryDzz likes this.
  23. El_boy

    El_boy

    Joined:
    May 23, 2013
    Posts:
    9
    I got this error after I added Jean Moreno's Cartoon FX Pack. It asked me it needed to update some scripts and prompted me to make a back up. It worked for a while after the update, then at some point I got this error. Got rid of the assets and it went away. Hope it helps someone.
     
  24. appvillas

    appvillas

    Joined:
    Aug 21, 2015
    Posts:
    14
    HEY GUYS !!!! i solved this error by uninstall unity and install again same version. cheeeeeeeeers