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 jpthek9 · Dec 23, 2014 at 12:22 AM · networkingrpcdatanetworkview

Which is better: NetworkView or RPC?

I recognize that the two function differently but for my use, they both can serve the same purpose. So when periodically syncing the position, rotation, and animation state (integer), which is better to use for best networking performance? or is the difference negligible?

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
1

Answer by Addyarb · Dec 23, 2014 at 12:31 AM

It's better to fire an RPC. NetworkView, if you're using reliable data, is going to keep it updated always. However, if you turn your network view off and just fire an RPC via the networkView, then that saves a lot of overhead.

However, you'll want to set some conditions to fire your RPC. For instance:

 if(Vector3.Distance(myTransform.position, lastPosition) >= 0.1)
         {
             //Capture the player's position before the RPC is fired off and use this
             //to determine if the player has moved in the if statement above.
             
             lastPosition = myTransform.position;
             
             networkView.RPC("updateMovement", RPCMode.OthersBuffered,
                             myTransform.position, myTransform.rotation);
         }


Comment
Add comment · Show 3 · 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 jpthek9 · Dec 23, 2014 at 01:06 AM 0
Share

Ah, tyvm. Just a sidenote, why have RPC$$anonymous$$ode set to OthersBuffered rather than Others? I never really understood the practical difference.

avatar image Addyarb · Dec 23, 2014 at 02:38 AM 1
Share

Good question. As far as I know, different buffering allows for different syncing to be applied. OthersBuffered in this case, is sending the RPC, and buffering those whom are not you. AllBuffered sends the RPC and buffers everyone including you. I'm not the best person to explain this to you, but I do believe AllBuffered will buffer your parameter to make it more realistic to everyone, where as OthersBuffered will give you feedback based on your actual location, and buffer everyone else so that no one viewer of you has any better idea of where you are than the other.

So, if you're trying to sync your player character with the rest of the world, you'd want to use OthersBuffered so that when you move forward, you will get immediate response ins$$anonymous$$d of waiting for everyone else to buffer it. However, if you're moving the sun across the sky, it's better to AllBuffer it so that all players get the same amount of light no matter how good their ping is.

Hope that makes sense, and that I'm right.

avatar image jpthek9 · Dec 23, 2014 at 03:20 AM 0
Share

$$anonymous$$ade perfect sense, ty:)

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

28 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

Related Questions

networkView not called on Child objects? 0 Answers

OnSerializeNetworkView issus in my 2D game 3 Answers

Overloading RPCs 1 Answer

Couldn't invoke RPC to server after Network.Destroy 0 Answers

NetworkView conflicts between Levels 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