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 Jesus_Freak · Jul 28, 2011 at 06:09 AM · c#networkingrpcvoid

Using an RPC call within an RPC function?

is it possible to send an RPC call to a client from an RPC function on a server? for example, can I send a message to the client with:

 [RPC]
 void ServerAddInfo(string name, string password, int score, NetworkPlayer player) {
     for(int i=0; i < profane.Count; i++) {
         if(!name.Contains(profane[i]) && !password.Contains(profane[i])) {
             PlayerNode newEntry = new PlayerNode();
             newEntry.name = name;
             newEntry.password = password;
             newEntry.score = score;
             newEntry.netPlayer = player;
             playerList.Add(newEntry);
             Debug.Log(name+" password="+password+" joined the game with a score of "+score); 
             Refresh(show, newEntry.name, newEntry.score);
         }
         if(name.Contains(profane[i]) || password.Contains(profane[i])) {
             networkView.RPC("RecieveAcceptOrDeny", player, "This is a clean game! Please don't use profanity!");
         }
     }
 }

or can a server not do that? will it do that if i add a networkView on it?

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

2 Replies

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

Answer by Waz · Jul 28, 2011 at 12:44 PM

Yes, you can do that just fine.

I have numerous times - it's almost unavoidable.

RPC just queues a message, so no risk of deadlock or anything like that.

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
1

Answer by umauj · Mar 30, 2012 at 12:02 PM

Sorry to dig that out again, but I really wanted to share my experience with you! Yes, it works to call RPCs inside RPCs, but it can lead to a misordering!

If the Server makes a RPCMode.All call and INSIDE that invokes a new RPCMode.All, then the RPCs are send in the wrong order to the clients (on the server it's fine). So keep that in mind. I'll file a bug-report, and hopefully this is fixed.

Comment
Add comment · Show 1 · 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 thegreatzebadiah · Oct 01, 2013 at 05:49 PM 0
Share

I am having this exact problem. Was there ever a solution to this?

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

Network.Instantiate doesn't update in Hierarchy? 0 Answers

SyncVar issue 0 Answers

Networking RPC sends to wrong target 0 Answers

Multiple Cars not working 1 Answer

ClientRPC not getting sent. 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