Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by HammerCar · Jan 07, 2016 at 04:47 PM · errornetworkingpathassembly

UNet Networking problem

I am making a 2D topdown multiplayer game with the new UNet networking.

Here is the part that has errors

 void Update () {
     if (Input.GetMouseButtonDown(0)) {
         CmdShoot (name, GetComponent<NetworkIdentity ().connectionToServer);
     }
 }

 [Command]
 void CmdShoot (string ownerName, NetworkConnection connection) {
     GameObject b = (GameObject)Instantiate (bullet, bulletSpawn.position, bulletSpawn.rotation);
 
     Destroy (b, 5f);
 
     b.GetComponent<SpriteRenderer>().sprite = weapons[selectedWeapon].bullet;
     bulletScript bs = b.GetComponent<bulletScript>();
     bs.bulletSpeed = weapons [selectedWeapon].speed;
     bs.damage = weapons [selectedWeapon].damage;
     bs.ownerName = ownerName;
     b.GetComponent<NetworkIdentity> ().AssignClientAuthority (connection);
     Debug.Log (b.GetComponent<NetworkIdentity> ().clientAuthorityOwner);
 
     NetworkServer.Spawn(b);
     RpcSpawnBulletClient (ownerName);
 }

 [ClientRpc]
 void RpcSpawnBulletClient (string ownerName) {
     GameObject b = (GameObject)Instantiate (bullet, bulletSpawn.position, bulletSpawn.rotation);

     Destroy (b, 5f);

     b.GetComponent<SpriteRenderer>().sprite = weapons[selectedWeapon].bullet;
     bulletScript bs = b.GetComponent<bulletScript>();
     bs.bulletSpeed = weapons [selectedWeapon].speed;
     bs.damage = weapons [selectedWeapon].damage;
     bs.ownerName = ownerName;
 }

and there are three errors:

  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 <filename unknown>:0 
       at Mono.Cecil.Cil.CodeWriter.WriteOperand (Mono.Cecil.Cil.Instruction instruction) [0x00000] in <filename unknown>:0 
       at Mono.Cecil.Cil.CodeWriter.WriteInstructions () [0x00000] in <filename unknown>:0 
       at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 
       at Mono.Cecil.Cil.CodeWriter.WriteMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 
       at Mono.Cecil.MetadataBuilder.AddMethod (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 
       at Mono.Cecil.MetadataBuilder.AddMethods (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0 
       at Mono.Cecil.MetadataBuilder.AddType (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0 
       at Mono.Cecil.MetadataBuilder.AddTypeDefs () [0x00000] in <filename unknown>:0 
       at Mono.Cecil.MetadataBuilder.BuildTypes () [0x00000] in <filename unknown>:0 
       at Mono.Cecil.MetadataBuilder.BuildModule () [0x00000] in <filename unknown>:0 
       at Mono.Cecil.MetadataBuilder.BuildMetadata () [0x00000] in <filename unknown>:0 
       at Mono.Cecil.ModuleWriter.<BuildMetadata>b__0 (Mono.Cecil.MetadataBuilder builder, Mono.Cecil.MetadataReader _) [0x00000] in <filename unknown>:0 
       at Mono.Cecil.ModuleDefinition.Read[MetadataBuilder,MetadataBuilder] (Mono.Cecil.MetadataBuilder item, System.Func`3 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, IEnumerable`1 dependencies, IAssemblyResolver assemblyResolver, System.String unityEngineDLLPath, System.String unityUNetDLLPath, System.String outputDir) [0x00212] in C:\buildslave\unity\build\Extensions\Networking\Weaver\UNetWeaver.cs:1733 
       at Unity.UNetWeaver.Weaver.WeaveAssemblies (IEnumerable`1 assemblies, IEnumerable`1 dependencies, IAssemblyResolver assemblyResolver, System.String outputDir, System.String unityEngineDLLPath, System.String unityUNetDLLPath) [0x00062] in C:\buildslave\unity\build\Extensions\Networking\Weaver\UNetWeaver.cs:1757 
     UnityEngine.Debug:LogError(Object)
     Unity.UNetWeaver.Log:Error(String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:20)
     Unity.UNetWeaver.Weaver:WeaveAssemblies(IEnumerable`1, IEnumerable`1, IAssemblyResolver, String, String, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1764)
     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)
     
    
  2.    Failure generating network code.
       UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)
    
    
  3.  error CS0016: Could not write to file `Temp/Assembly-CSharp.dll', cause: Sharing violation on path F:\...\Temp\Assembly-CSharp.dll.mdb
    
       Compilation failed: 1 error(s), 0 warnings
    
    

I don't really know what to do so please help.

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dave-Carlile · Jan 07, 2016 at 04:54 PM 0
Share

Is your game running? Check the task manager to see if the process is still there even if you can't see a window. Close out of Unity and make sure it's not still showing in task manager. Sometimes the shader compiler keeps running - close/kill those. Reboot. etc.

avatar image HammerCar Dave-Carlile · Jan 07, 2016 at 05:16 PM 0
Share

I closed Unity and couldn't find anything related to Unity in task manager. Then I rebooted my computer and after updating a script the error showed up again

avatar image Dave-Carlile HammerCar · Jan 07, 2016 at 06:43 PM 0
Share

Virus scanner maybe? You should be able to find a tool to see what app has the file open.

avatar image NateJC · Apr 10, 2017 at 10:52 AM 0
Share

I am having a similar "System.ArgumentException: $$anonymous$$ember '...' is declared in another module and needs to be imported" Did you ever resolve this issue?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by seanr · Jan 08, 2016 at 02:10 PM

you cant pass a NetworkConnection in a command.

If you want access to the connection to the client that called the command it is base.connectionToClient

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HammerCar · Jan 08, 2016 at 03:53 PM 0
Share

Do I use AssignClientAuthority for that?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

39 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity [PUN] New Instantiated players cannot see previously instantiated players 0 Answers

Mirror network error : There is already a player for this connection. 1 Answer

NetworkClient Send with no Connection 0 Answers

Error: "Copying assembly from 'Temp/UnityEngine.TestRunner.dll' to 'Library/ScriptAssemblies/UnityEngine.TestRunner.dll' failed" 1 Answer

Getting "copying assembly from temp folder to library script assemblies failed". Tried everything, nothing works. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges