5.2 Broke my project?

Everything was fine for me in 5.1.3…but when I updated to 5.2 and reopened my project, I got these two errors that are completely stumping me…

ERROR #1

UNetWeaver error: Exception :System.ArgumentException: Member ‘System.Int32 UnityEngine.Networking.NetworkConnection::hostId’ is declared in another module and needs to be imported at Mono.Cecil.MetadataBuilder.LookupToken (IMetadataTokenProvider provider) [0x00000] in :0 at Mono.Cecil.Cil.CodeWriter.WriteOperand (Mono.Cecil.Cil.Instruction instruction) [0x00000] in :0 at Mono.Cecil.Cil.CodeWriter.WriteInstructions () [0x00000] in :0 at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in :0 at Mono.Cecil.Cil.CodeWriter.WriteMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in :0 at Mono.Cecil.MetadataBuilder.AddMethod (Mono.Cecil.MethodDefinition method) [0x00000] in :0 at Mono.Cecil.MetadataBuilder.AddMethods (Mono.Cecil.TypeDefinition type) [0x00000] in :0 at Mono.Cecil.MetadataBuilder.AddType (Mono.Cecil.TypeDefinition type) [0x00000] in :0 at Mono.Cecil.MetadataBuilder.AddTypeDefs () [0x00000] in :0 at Mono.Cecil.MetadataBuilder.BuildTypes () [0x00000] in :0 at Mono.Cecil.MetadataBuilder.BuildModule () [0x00000] in :0 at Mono.Cecil.MetadataBuilder.BuildMetadata () [0x00000] in :0 at Mono.Cecil.ModuleWriter.b__0 (Mono.Cecil.MetadataBuilder builder, Mono.Cecil.MetadataReader _) [0x00000] in :0 at Mono.Cecil.ModuleDefinition.Read[MetadataBuilder,MetadataBuilder] (Mono.Cecil.MetadataBuilder item, System.Func3 read) [0x00000] in <filename unknown>:0 at Mono.Cecil.ModuleWriter.BuildMetadata (Mono.Cecil.ModuleDefinition module, Mono.Cecil.MetadataBuilder metadata) [0x00000] in <filename unknown>:0 at Mono.Cecil.ModuleWriter.WriteModuleTo (Mono.Cecil.ModuleDefinition module, System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 at Mono.Cecil.ModuleDefinition.Write (System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 at Mono.Cecil.ModuleDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 at Mono.Cecil.AssemblyDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 at Unity.UNetWeaver.Weaver.Weave (System.String assName, IEnumerable1 dependencies, IAssemblyResolver assemblyResolver, System.String unityEngineDLLPath, System.String unityUNetDLLPath, System.String outputDir) [0x001d1] in /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1616 at Unity.UNetWeaver.Weaver.WeaveAssemblies (IEnumerable1 assemblies, IEnumerable1 dependencies, IAssemblyResolver assemblyResolver, System.String outputDir, System.String unityEngineDLLPath, System.String unityUNetDLLPath) [0x00062] in /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1640 UnityEngine.Debug:LogError(Object) Unity.UNetWeaver.Log:Error(String) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:20) Unity.UNetWeaver.Weaver:WeaveAssemblies(IEnumerable1, IEnumerable1, IAssemblyResolver, String, String, String) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1647) Unity.UNetWeaver.Program:process(String, String, String, String[ ], String[ ], IAssemblyResolver, Action1, Action1) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:34) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

ERROR #2

Failure generating network code. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

I’m all but certain the second error is a result of the first. Anyone else encounter(ing) this, or can help?

First of all, please USE VERSION CONTROL You’re playing on a high wire without a safety net if you aren’t using version control.

When you are correctly using Version control in Unity (look up the docs on setting it up properly!), you will have visible meta files enabled, and you will NOT actually put Library or Temp under version control.

Then when this sort of issue comes up, all you (probably) need to do is reimport all, or barring that, delete the Library and Temp directories and reopen Unity.

But don’t do this until you have made a complete backup.

And if you insist on playing with knives (i.e., not using version control), every morning before you start working, make a complete zip file of your project and put it somewhere safe.

As the old haiku says:

three things are certain
death, taxes and data loss
guess which has occurred

1 Like

Yes, I have my own system of version control. However, do you have an actual answer to my question?

Third paragraph of my posting?

Nope. Closed project… Deleted folders… Reopened project… Errors still exist.

My googling indicates this MIGHT be an open Unity bug.

Not sure if it is the same thing. Your best bet might be to roll back to the earlier version of Unity.

I’m thinking you’re right…about rolling back (for now). It seems 5.2 has some MAJOR bugs. Just to see if I could locate the problem, I started up a new project, and began importing assets one-by-one…and Unity just crashes at random moments…a LOT.

I would suggest submitting a bug report to UT.

For now it’s best if you go back to old Unity. It’s usually risky to update software during project unless you’re 100% certain that it won’t crash.

Do you have any scripts attached in the project? Are you using any services like Unity Analytics, UnityAds, Everyplay, Multiplayer?

EDIT: According to your error log, you’re using UNET for multiplayer, right? In Unity 5.2, Unity Multiplayer has been integrated into project, maybe that might be the cause of the issue.

I think you need to rewrite your UNET related code.

We ran into stuff like this because some RPC call had an argument that resulted in a serialization loop. Of course it’s not really documented what you can and can’t use. Ultimately, it’s a garbage error that doesn’t give you any real information.

Honestly - the new networking stuff really needed some more time in the oven.

I do have scripts attached, but I’m not using any services. It’s just as @KelsoMRK said, the error doesn’t give any information to assist in finding the issue(s).

UPDATE - I rolled back to 5.1.3, and I’m getting the same issue, and it’s actually even WORSE now. Check out the screenshot below.

UPDATE - Well I figured out what happened with the “Asset” error…but that UNetWeaver error is still a major pain in my rear.

You might have better luck asking in the Networking section. Someone there might be able to at least narrow it down to what types of arguments are throwing it off.