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
1
Question by leonardo_try · Sep 26, 2011 at 11:43 PM · multiplayerrpccalllobby

Temporarily hold Buffered RPC call

Hey guys, I'm making a multiplayer game. It has a lobby on the menu, where the client connect to server to get informations, and then, when the client click "Join" it loads the level and play. The problem is: i'm using the Network.Instantiate function to create the players on the game, and i've notice that Network.Instantiate uses a buffered RPC call, so when i connect on the lobby, it instantiate the players, but i need it to happen just when the player get with the level loaded. Any one know how to temporarily hold a buffered rpc call, so when i finish load the level (i already have a function for that) it let the RPC calls be executed?

Thanks in advance.

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 slatius · Sep 27, 2011 at 12:12 AM 1
Share

see the networking example provided by unity....

There is an object that sends a message (OnNetworkLoadedLevel) to all objects in game.. the spawnPlayer object receives that message and only then it spwans the player...

1 Reply

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

Answer by syclamoth · Sep 27, 2011 at 12:15 AM

Instead of instantiating your players immediately when they join, why don't you use Network.Instantiate upon level loading? There's no need to instantiate things as soon as players connect, since you can just store a list of players in some gameEngine object that keeps track of this stuff until your game actually begins, at which point you can instantiate everything at once, and be sure that all players will get the message at the same time!

Comment
Add comment · Show 4 · 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 leonardo_try · Sep 27, 2011 at 12:48 AM 1
Share

the problem is that unity automatically instantiate the player prefabs when it connect to one server, because it use a buffered RPC call

avatar image Bunny83 · Sep 27, 2011 at 01:08 AM 0
Share

Unity isn't doing anything like that automatically. Your player prefab is instantiated by one of your scripts. Beside that I really don't like Network.Instantiate especially because of the buffered RPC. I never use any buffered RPC since you almost can't control the removal of them.

In our Hack&Slash game i use only one NetworkView and it's placed on a manager object in the scene. All communication we do over this NetworkView. The clients use normal RPCs to send information to the server and the server distributes the information via OnSerializeNetworkView and normal RPCs.

You can use Network.Instantiate if you can live with it's drawbacks.

avatar image syclamoth · Sep 27, 2011 at 02:26 AM 1
Share

I personally never use Network.Instantiate if I can avoid it- the automatic buffering is pretty annoying. I use Network.AllocateViewID() and then send RPC functions which make sure the NetworkViewIDs stay the same on instantiated objects (which basically does the same thing, but with more control over buffering). To be fair, Network.Instantiate is, however, much easier to use.

avatar image leonardo_try · Sep 27, 2011 at 09:27 PM 0
Share

Thanks, i'm using the Network.AllocateViewID() and passing it in RPC (not buffered) for the players... and when a new player connect, the server send all viewIDs to the new player.

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

RPC call on other scene,NetworkView RPCs in other scene, 0 Answers

switching from NetworkManager to LobbyNetworkManager: NullReferenceException 1 Answer

RPC call failed 1 Answer

Networked Piano 0 Answers

Displaying players name above in multiplayer 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