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 recagonlei · Nov 27, 2016 at 08:25 AM · networkingspawnsync

[uNET] Network objects spawned not spawn in new clients

Hi guys, how you guys can saw in the title, i'm facing a problem and i can't figure out how to resolve that... I googled and searched in the internet for 3 days, and still not getting how to work that... Well, basicaly I have a script that spawn a weapon to players, everything works fine on client-host, but when i connect with other clients, the last client connected, not spawn the weapons instantiated before like weapon spawned on the client-host... Let me explain better: I start a host, the weapon spawn localy and on the server. I connect a client, the client spawn the weapon localy and on the server too. On host-client, the weapon of the client spawns fine but in the client, the host-client's weapon already spawned, not spawn in the client... I Connect a third client to see better and when i connect the third client, the second client spawn the weapon of the third client, but the host-client's weapon still not... And like a said before, the host-client and the second client, not spawn at all the weapons on the third... In the host-client, it spawns the weapons of all clients that connect... Long story short, all clients that connect, spawns the weapons in the host-client, and in the clients already connected, but if some client or the host, spawn the weapon before a client connect, that client not spawn the other clients weapons...

Here the code that spawn the weapons:

   void Start()
   {
    if (isLocalPlayer) 
       Cmd_InstantiateWeapon ();
   }

 [Command]
 void Cmd_InstantiateWeapon()
 {
     GameObject _gm = Instantiate(Resources.Load("Weapons/TestPistol")) as GameObject;
     _gm.GetComponent<Weapon> ().parentNetId = GetComponent<NetworkIdentity> ().netId;
     _gm.transform.SetParent (_hand.transform, false);
     NetworkServer.SpawnWithClientAuthority (_gm, this.gameObject);

     Debug.LogWarning ("Spawned weapon in a server");
 }

If someone could help-me, i would aprecciate... I'm 3 days trying to resolve that and i can't figure out how to do...

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by recagonlei · Nov 27, 2016 at 07:21 PM

I was spawning the objects deactived, because of that it was not spawning in new clients...

Comment
Add comment · 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

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

99 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 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 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

How to sync SetActive at NetworkServer.Spawn() ? 1 Answer

How to sync RPC function Photon Network? 1 Answer

Networking concept and spawning questions 1 Answer

Network Rotation not sync 2 Answers

Can I get NetworkTransform to sync local coordinates instead of world coordinates? 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