Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 YoungDeveloper · Feb 11, 2014 at 09:01 PM · networkinginstantiatespawningnetwork.instantiateplayers

Networking | Getting buffered other - previous spawned players

When all players are connected and server launches scene, everybody can see each other, everything works perfectly. This is what most tutorials are showing, everybody connects and server launches scene. But, when server and scene is already launched and player connects, he does not see previously connected players. Previously connected users see all newest connected player, but new player doesnt. If someone else joins, then again, he wont see anyone, previous player will see himself and newest member, but player who was joined at the start sees all 3.

Network.Instantiate is buffered, so problem should be with the way i spawn players. I've tested the spawning many ways and in countless combinations. Via Awake (spawn on new scene), as DontDestroyOnLoad, OnPlayerConnected, OnLevelWasLoaded and couple other ways. The way I set it up, theoretically result should have be the same (if taking stricly unity docs mentioned information), but at the end they all give somewhat different results. So after 2 days, today i kinda got out of ideas, and started to get into loop.

For now, im spawning the player in the new scene on Awake(), and transferring another GO from previous scene with DontDestroyOnLoad (for not disconnecting) as it is stable, and everything works perfectly, except my mentioned problem. I understand the problem is "with the way you spawn", so awake() solution shouldn't be really the one.

Thank you very much.

Comment
Add comment · Show 1
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 FLASHDENMARK · Feb 13, 2014 at 10:27 AM 1
Share

I have had my fair share of related problems. What I think is happening is that your game is being told to Instantiate the players when the game really isn't ready to(eg. when your players is being spawned just before you load your scene, then they will usually be destroyed).

Depending on how you have setup you scenes, players etc. Only when the scene is fully loaded should you Instantiate your players. Therefore I use PhotonNetwork.is$$anonymous$$essageQueueRunning = false(or you equivalent) to stop inco$$anonymous$$g network messages(messages telling me to Instantiate). And then only set it to true when your scene is fully loaded.

1 Reply

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

Answer by YoungDeveloper · Feb 13, 2014 at 01:40 PM

lmao, i just tried this 3 minutes ago and it worked. Of course now the problem is that i see all other players only where they were spawned, because thats the only buffered information. But if they start to walk to some location, clone will go to that new point.

So just for the record, in C#, instead of reactivating MessageQueueRunning and SetSendingEnabled in "LoadLevel" (like in this example http://docs.unity3d.com/Documentation/Components/net-NetworkLevelLoad.html), reactivate them only when actual scene is loaded, took me 4 days to get this.. god..

 void OnLevelWasLoaded(int level) {
     Network.isMessageQueueRunning = true;
     Network.SetSendingEnabled(0, true);
     ///other stuff what you want to do, for example spawn player
 }
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

21 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

Related Questions

Network.Instantiate and NetworkServer.Spawn not working 2 Answers

Network.Instantiate/Destroy vs Instantiate/Destroy on each client using [Command] and [ClientRpc] 1 Answer

Players Not Showing 0 Answers

Help me please with Unity Multiplayer 1 Answer

Problems with spawning items that the players can pick up - Unet 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