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 moka_one · Sep 14, 2012 at 04:57 AM · networkrpcnetworkplayer

Sending Network player info with RPC

Hi all, I'm having quite an issue an I don't really get it... In my situation I send from the server to the clients the list of players which are in game and operational, so they can send RPC to them as they are ready to handle them. But when a second client joins my game and my server sends to him the network player info of the first connected client the info sent by the server are not the same received on the other side.. Here are 2 screenshots, first on is what the server sends to the newly connected client :

the second on is what is received on the other side...

Anybody has a clue of what could be wrong ?

Thanks in advance

List item

Comment
Add comment · Show 6
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 whydoidoit · Sep 14, 2012 at 08:56 AM 1
Share

Your screen shots appear to be missing.

avatar image whydoidoit · Sep 14, 2012 at 08:57 AM 1
Share

Can you also post the code that performs the sending?

avatar image moka_one · Sep 14, 2012 at 01:31 PM 0
Share

Hi, yes I think there's an issue for posting images cause it appears I can't click on validate... Anyway here's the code of the sending and the RPC that receive it: /*The server sends to the newly updated client all the networkplayers that are in game. Like this clients and server are only sending RPC on clients that are in game and not to some remote connected client that are trying to join during a game already launched */

 foreach(NetworkPlayer np in _DNetworkIdsToPlayers.$$anonymous$$eys)
 {
      foreach(int i in _DNetworkIdsToPlayers[np])
         networkView.RPC("UpdatePlayerNumber", p_np, np, i,(int)_PlayersList[i]._Captain, _PlayersList[i]._bCharacChoosed );
 }
 
 
 /* Then on the client side we add this networkplayer to a list in order to adress the RPC directly to all the connected client that are InGame */

[RPC] private void UpdatePlayerNumber(NetworkPlayer p_NetworkPlayer, int p_iPlayerNumber, int p_iCaptain, bool p_bCharacChoosed) { if(Network.isClient && !_Network.bIsConnected()) return; if(_PlayersList[p_iPlayerNumber] != null) { _PlayersList[p_iPlayerNumber]._Captain = (PlayerProfile.eCaptains)p_iCaptain; _PlayersList[p_iPlayerNumber]._bCharacChoosed = p_bCharacChoosed; _PlayersList[p_iPlayerNumber]._bBeEdit = false; } if(!_DNetworkIdsToPlayers.Contains$$anonymous$$ey(p_NetworkPlayer)) { List l = new List(); l.Add(p_iPlayerNumber); _DNetworkIdsToPlayers.Add(p_NetworkPlayer, l); } else if(!_DNetworkIdsToPlayers[p_NetworkPlayer].Contains(p_iPlayerNumber)) { _DNetworkIdsToPlayers[p_NetworkPlayer].Add(p_iPlayerNumber); } }

The networkplayer ID reiceved is fine when it's the server's one, but when it's another client already connected, the id is correct but the ipAddress field is empty...

$$anonymous$$y concern is, after updating this ingame playernetwork list, when a client tries to send an RPC directly to another, the reicever gets errors about uncorrect viewID 0 not existing, but the rpc's are sent with correct networkviews that are not with id 0....

avatar image moka_one · Sep 15, 2012 at 12:44 AM 0
Share

As far as I find out, whenever a NetworkPlayer is sent through RPC, it's only an integer.. The only thing is that as it's casted as a NetworkPlayer, it points to the local structure connections[] . So when you are on the client side, the structure connections[] contains only the info for the server, and this is why the networkID received is correct but all the IpAddress fields are empty... So basically, is it possible to send a RPC from a client directly to another client using


//This on a client directly to another client
NetworkPlayer otherClient;
networkView.RPC("foo", otherClient, ....);

avatar image whydoidoit · Sep 15, 2012 at 12:47 AM 0
Share

I've converted your answers to comments - on UA Answer means Solution and not Reply - there's an add new comment button hidden on the right of the screen. Also your comments do not require moderation.

I believe you can send using the NetworkPlayer which can be a parameter to the RPC call.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Azran · Sep 14, 2012 at 12:29 PM

I cannot see your screenshoots, althought

Have you check if you use Buffered RPC?

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 moka_one · Sep 14, 2012 at 01:49 PM 0
Share

no, I don't use buffered RPC, nor network.instantiate, nor network.Destroy. As I want that my connectec players receive the Gameplay RPC only if they are in game and not trying to joining it, I maintain an up to date list of players in game and sending the RPC directly between them. But I do think the problem is when a client sends an RPC directly to another client specific..

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

11 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

Related Questions

RPC a lot of lags (Photon) 0 Answers

Unity3d Network - Cant See Connected Players 3 Answers

Really quick/easy question about RPCs 1 Answer

Getting rotation to work on client 1 Answer

Network RPC 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