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 Anymeese · Aug 26, 2014 at 08:46 PM · networkingmultiplayernetworkrpconline

How to use an RPC to send an animation over the network?

I am working on a 2player (1v1) game, online thanks to Unity's native networking code and want to play an animation on a character for BOTH the host and the joiner. I searched around a little and read that I need to do it normally for the host, then use an RPC to send the updated info (saying to play the animation) to the joiner. However I didn't find any posts actually walking someone through this, and I do not know how to utilize RPCs yet.

Do I need any specific component on my main game object that holds all the scripts, is it just a simple line of code, or what?

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 Anymeese · Aug 26, 2014 at 10:43 PM 0
Share

Wow, that link was SUPER helpful, thank you!! Two quick questions..

1) I played around with it and noticed that any script can define an RPC function and any script can make the RPC call, regardless of the "focus" of the NetworkView component. Does the focus ever matter if I'm doing STRICTLY RPC's (no state sync), or should I just ignore it?

2) So I know how to call a basic function as an RPC function, but in part of my code, I have a coroutine that makes units turn to face a certain object. It waits for one unit to turn then makes the other, so in the code it looks like this:

 yield return StartCoroutine(myCoroutine(firstUnit));
 yield return StartCoroutine(myCoroutine(otherUnit));

How can I do THAT as an RPC function?

EDIT: added a 2nd question

avatar image AyAMrau · Aug 27, 2014 at 01:24 AM 0
Share

1) it doesn't matter in this case, you may even set the synchronisation to off. All you need is a networkView on the object that is using RPCs

2) never done that our came across that, but I have two guesses: - send an RPC that starts a coroutine on the other client, so they work on both sides independently. Probably feasible if they produce consistent results, but some desynchronisation may occur. - have the side running the coroutine send state updates via RPC to the other client.

Though if it's about facing direction, isn't it an option to just synchronise the transform using networkView?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by AyAMrau · Aug 26, 2014 at 09:49 PM

Have you read the RPC Manual? Since you can't just send an animation, so you will either need to pass it's name or some other value that will trigger a state change in the remote client (depends really on the setup in your game)

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
avatar image
0

Answer by siddharth3322 · Aug 27, 2014 at 02:06 AM

You don't have to send any animation over network. It always play locally on any device. You have to communicate over all devices that it is a time to start playing animation.

You have to use RPC for this purpose only. So no jittering generates at all for your game.

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

24 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

Related Questions

[Error] RPC function undefined in IRRELEVANT file? 0 Answers

Multiplayer - Selected character to Network.guid? 0 Answers

Unity networking tutorial? 6 Answers

Testing my multiplayer character offline 0 Answers

RPCMode.AllBuffered Basic Question 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