Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by mastegar · May 04, 2016 at 01:03 AM · unity 5networking

Why is this ClientRPC not executed?

I am trying to sync some variables (Vector3 arrays and integers) over the network via a ClientRpc method in a NetworkBehaviour script. This script is attached to gameplayer prefabs which are created by unity on entering the play scene (I use a NetworkLobbyManager).

But the ClientRpc method isn't executed. I have checked multiple times if I did everything right syntax wise and I looked through the manual and scripting API in search of clues, but I haven't been able to come up with an explanation of why the method won't fire. It looks like this:

 [ClientRpc]
 public void Rpc_SyncBoardData(Vector3[] _team1BaseLocations, Vector3[] _team2BaseLocations, int _boardHeight, int _boardWidth)
 {
         team1BaseLocations = _team1BaseLocations;
         team2BaseLocations = _team2BaseLocations;
         boardHeight = _boardHeight;
         boardWidth = _boardWidth;
 
         StartCoroutine("WaitForGameManager");
 }

This ClientRpc is called on the server only, from a MonoBehaviour class on another gameobject. That line looks like this:

 localPlayer.Rpc_SyncBoardData(team1BaseLocationsArray, team2BaseLocationsArray, (int)boardHeight, boardWidth);

I have already tried a lot of things to see what's wrong with it. I tried invoking the function without arguments and from the game player prefab itself, instead of another gameobject. I tried another ClientRpc method which also didn't work. I double checked if I have a NetworkIdentity attached (I have and it is set to Local Player Authority) and if the script inherits NetworkBehaviour. Nothing fixed it.

What could be the problem here? Am I not seeing something obvious?

There is also a NetworkTransform attached to the game player prefab. Perhaps that affects the ClientRpc calls. Furthermore, no errors are raised so I have absolutely no clue.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by mastegar · May 04, 2016 at 03:36 PM

I found out why it didn't work. I was calling the ClientRpc method before the game player objects on clients were properly set up by OnLobbyServerSceneLoadedForPlayer. To fix it I just waited with calling the ClientRpc until after the start method was invoked on all client gameplayer objects.

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 ferrisbuellers · Apr 19, 2017 at 10:55 AM

How did you do that? LIke wait until start method invoked

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 yonatanab1 · Mar 14 at 06:18 PM

would also like to know

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

96 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 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 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 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

How do I get the true position (Vector 3) from a Network Transform Component(Unet)? 0 Answers

Day/Night cycle turns black at night and how to Serialize it rightly? 0 Answers

Photon Networking - How to move all players from game scene to current room scene? 0 Answers

How to count score on all players from non player object 0 Answers

unity NetworkingLobbyManager problem 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