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 fred_gds · Apr 23, 2014 at 10:18 PM · multiplayernetworkrpcnetworkview

get return on networkView.RPC

Hey

I have following line of code:

networkView.RPC("Register",RPCMode.Server,username);

So my problem with that line is, that I need to get an answer from the server whether or not the username is already used by another player. But I don't know how I could send the message from the server back to the client. As I only want this one client to get the answer not all clients.

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 Kiloblargh · Apr 23, 2014 at 10:37 PM

You just need to check the NetworkMessageInfo.sender attribute sent automatically with the RPC :

from the docs:

 @RPC
 function PrintText (text : String, info : NetworkMessageInfo)
     {
     Debug.Log(text + " from " + info.sender);
     }

AFAIK there is no RPCMode that lets you send to a single specific player (why not? dunno...) but you can use RPCMode.Others and have it just do nothing if the sent network player id does not match the local player's.

But I'm not sure about your idea of using a Unity game server to register / keep track of in-use usernames in the first place, I would use (actually, am using) a WWWForm connecting to a PHP script connecting to an SQL database.

Comment
Add comment · Show 2 · 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 fred_gds · Apr 23, 2014 at 10:51 PM 0
Share

hmm.

I understand your doubts. But I always struggle setting up sql databases, well I mostly fail, so I was trying to get around it. I was going to handle a high amount of users through that network view, so sending messages to all users will be quiet a problem.

I guess I need to either lern that sql and php stuff or find another way to setup a server-client-system

avatar image Kiloblargh · Apr 23, 2014 at 11:10 PM 0
Share

They needn't all be connected to it at once. If I understand what you're trying to do, a player would connect to your 'login server', first, get a response, then disconnect. Once they're in a game, they are directly connected to another player and their username is stored in the login server's PlayerPrefs. If your game is an $$anonymous$$$$anonymous$$O, you should go with a third-party $$anonymous$$$$anonymous$$O server solution because Unity's built in networking won't cut it. (Also if setting up a database is a struggle for you, taking on a $$anonymous$$$$anonymous$$O project is just masochism.)

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

20 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

Related Questions

Sending info to/from different networkViews 1 Answer

Does the position change need state synchronization? 2 Answers

How do you remove RPC's from the RPC buffer that where created on behalf of a player that is now disconnected with an authoritative server? 1 Answer

Photon Networking: RPC call doesn't work over other clients 0 Answers

Help with Network Script. Game with multiple Maps. 2 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