• 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 Piesk · Sep 04, 2016 at 06:05 PM · networkingspawning problems

SpawnWithClientAuthority not affecting remote clients

Edit - rewriting this as initially wasn't clear.

When a client connects to the server, I want to spawn an object and assign that client authority over that object.

using the following code:

    [Command]
         public void CmdSpawnBase()
         {
             GameObject myBase = (GameObject)Instantiate(m_baseList[Player.g_connectedPlayers.Count - 1]);
             myBase.transform.parent = SceneManager.Instance.m_sceneList[1].transform;
             NetworkServer.SpawnWithClientAuthority(myBase,gameObject);
     
         }

This results in everything going as expected on the host, the objects spawn, are assigned to the parent and have appropriate authority set. However, while the remote client can see the objects, they do not have authority set and have not had their parent transform set. I'm hoping I'm missing something really obvious here but i've been tearing my hair out over getting these objects to behave as wanted for ages.

Really struggling with this -_- any and all help is appreciated.

Comment
Add comment · Show 2
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 Piesk · Sep 06, 2016 at 02:18 PM 0
Share

So have come across ClientRPC calls, will be trying a callback system using them tonight. I suspect this will solve the problem :).

avatar image Piesk · Sep 06, 2016 at 08:58 PM 0
Share

Update - Using [ClientRpc] I managed to get all clients to update the spawned objects to have the correct parent \o/ yay me.

However, the bigger and more important problem still persists. When I try to assign client authority, It tells me client authority can only be assigned on the server... Now that's all fine and dandy...except the server doesn't tell the clients about authority...It sets it and then just goes for a $$anonymous$$ break and flips the bird to the clients.... There must be a way for clients to have authority over objects surely?

1 Reply

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

Answer by Piesk · Sep 06, 2016 at 09:45 PM

Ok so I solved this problem, but by not using the network set up for authority, it seems to be very buggy at the moment. Instead I just set up my own member variable of owning player, set that using commands and RPCs and checked against it when trying to interact with said object.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

85 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

Related Questions

Unet: Bullets only spawn only spawn on host, visible only on host 0 Answers

How to properly spawn prefabs in a multiplayer game? 2 Answers

'Spawn scene object not found 1' Error 3 Answers

Problem with using Unity Spawnsystem (Unet / Multiplayer) 0 Answers

Unity Unet spawnig Fail,Unity Unet NetworkManager spawning fail 1 Answer


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