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 Christian Rie · Apr 11, 2011 at 11:39 AM · gameobjectrpcwrong

Possible Bug with RPC calls (Unity 2.6)

Hi,

I am currently developing a multiplayer action game with Unity 2.6. After working fine for a long time, I am suddenly getting Error Messages and the game stops functioning.

The Error Message is:

RPC call failed because the function 'RPCNetworkManagerReady' does not exist in any script attached to'Network Level Rip-In'

The strange part is, that the script which calls the function is in fact not attached to the 'Network Level Rip-In' Object, but to a GameObject called 'Game'. The basic application structure is this 'Game' object, which exists over the whole game and is conserved, if a new level is loaded.

Other objects, like menus or levels (like the 'Network Level Rip-In') are loaded when needed.

The script which is executed and produces the Error is the NetworkManager.cs, which is attached to the 'Game' object. The function is WaitForServer() and is used to synchronize all clients and the server before the start of the game (written in C#):

public bool WaitForServer() {

 if(offlineMode || Network.isServer)
     return false;

 if(waitingClients == 0) {
     Debug.Log("NetworkManager.WaitForServer: Signaling READY to server");
     networkView.RPC("RPCNetworkManagerReady", RPCMode.Server);
     waitingClients = -1;
 }
 else if(waitingClients == 1) {
     return false;
 }

 return true;

}

This script is called by another script, the GameLoader, which is attached to the 'Network Level Rip-In' object. As I already said, it is used to synchronize the game states of all Clients:

private IEnumerator LoadGame() {

     /* ... more code ... */

 if(!networkManager.IsServer()) {
     do {
         yield return 0;
     } while(networkManager.WaitForServer());
 } else {
     do {
         yield return 0;
     } while(networkManager.WaitForClients());
 }

     /* ... more code ... */

}

LoadGame() is called by the Start() function of the GameLoader.cs:

void Start() { /* ... initializing variables ... */

 StartCoroutine(LoadGame());

}

So if a multiplayer game starts, both the client and the server will begin loading their levels. If a client or a server is done, it will start waiting for the rest of the players. The server will give his go to all clients, if he received the ready signal from each client.

This would be our RPC call (networkView.RPC("RPCNetworkManagerReady", RPCMode.Server)), but it never reaches its destination. It seems, that the call is assigned to the wrong GameObject, but we already checked the IDs of the NetworkViews, which are the same on both client and server

If there is no flaw in the scripts I can only assume that this is a Unity-Bug mixing up the RPC call IDs. As I said, we attached a NetworkView component to each GameObject.

I would be pleased if there was a solution that did not include "upgrading to a newer version", since refactoring would surely kill our timeframe.

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 Christian Rie · Apr 27, 2011 at 12:33 PM

Seems like I found the solution. I had to stop all RPC calls and erase the RPC stack. Additionally I had to set the Network's levelPrefix to prevent the mixup of the game objects. The example that lead the way can be found here: http://unity3d.com/support/documentation/Components/net-NetworkLevelLoad.html

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

No one has followed this question yet.

Related Questions

Animation refuses to play 1 Answer

How would you override Editor object dragging? 0 Answers

Calling functon attached to another object (Javascript) 2 Answers

Using Scripts in AssetBundles 0 Answers

Moveing my camera 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