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 /
avatar image
0
Question by muldore · Aug 27, 2016 at 06:55 AM · networkingunity5client-serverserver-hostingnetwork instantiate

Networked Objects not appearing on Client when Client loads scene first

I'm having an issue with object instantiation in my multiplayer game. The game layout is simple: Players enter a lobby and once everyone marks ready there is a countdown and the LobbyManager calls ServerChangeScene(gameScene) to load the game level. The problem is that on a lot of the loads all of the networked objects are not instantiating on the client. After a bit of playtesting I noticed that this seems to only happen when the client loads up the scene before the server - when the server loads first everything appears correctly and the game plays as it should. Is there a way to ensure the server loads first?

Some code for reference:

 public override void OnLobbyServerPlayersReady()
 {
     currentNumberTeam1 = 0;
     currentNumberTeam2 = 0;
     StartCoroutine(ServerCountdownCoroutine());
 }

 public IEnumerator ServerCountdownCoroutine()
 {
     float remainingTime = _matchStartCountdown;
     int floorTime = Mathf.FloorToInt(remainingTime);

     while (remainingTime > 0)
     {
         yield return null;

         remainingTime -= Time.deltaTime;
         int newFloorTime = Mathf.FloorToInt(remainingTime);

         if (newFloorTime != floorTime)
         {
             floorTime = newFloorTime;

             for (int i = 0; i < lobbySlots.Length; ++i)
             {
                 if (lobbySlots[i] != null)
                 {
                     (lobbySlots[i] as CharacterSelect).RpcUpdateCountdown(floorTime);
                 }
             }
         }
     }

     for (int i = 0; i < lobbySlots.Length; ++i)
     {
         if (lobbySlots[i] != null)
         {
             (lobbySlots[i] as CharacterSelect).RpcUpdateCountdown(0);
         }
     }
     
     ServerChangeScene(playScene);
 }

Thanks!

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

Answer by inconaks · Sep 07, 2016 at 06:34 PM

Setting minimum players in the lobby manager settings to the exact amount of players that will play did the trick for me.

Edit: it's not the case, it sometimes works and sometimes not.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

UNet ClientRPC does not fire 2 Answers

UNET - Syncing prefabs spawned by clients. 3 Answers

Can MLAPI connect to a standalone server written in another language (Go) 0 Answers

Unet: Client/Server end up with two different animations 0 Answers

ClientRpc Function not being carried out on all clients in Unity3d c# 0 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