Search Unity

Mysterious RPC error

Discussion in 'Connected Games' started by Factoid, Dec 3, 2008.

  1. Factoid

    Factoid

    Joined:
    Mar 30, 2008
    Posts:
    69
    Hi, a script that we haven't touched for some time is now giving us the following error.

    The code essentially looks like this.

    Code (csharp):
    1.  
    2. function Update () {
    3. // ... stuff
    4.     networkView.RPC( "RPCNewWindHeading", RPCMode.Others, currentHeading );
    5. }
    6.  
    7. @RPC
    8. function RPCNewWindHeading( heading : float, info : NetworkMessageInfo )
    9. {
    10.     Debug.Log( "In New Wind Heading" );
    11. }
    Any thoughts?
     
  2. Factoid

    Factoid

    Joined:
    Mar 30, 2008
    Posts:
    69
    Bump. We were able to correct this problem by moving scripts to the Standard Assets folder, but the problem has returned. Could this be a problem with interplay between .js and .cs scripts?

    Any developers that can weigh in on what this error message means? I just can't find any hints as to what I'm supposed to do about this.
     
  3. Factoid

    Factoid

    Joined:
    Mar 30, 2008
    Posts:
    69
    I've found a work-around to the problem. But unfortunately it is done by removing the script, and its references from all assets, then re-introducing the script to the engine (Un-install and re-install).

    This suggests to me that something is being corrupted in the asset database, since simply re-importing the scripts doesn't seem to do anything.

    Has this, or something similar, happened to anyone else? Are there any less destructive ways to repair the project when it happens?
     
  4. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    It sounds like you found the solution to the problem, which I myself ran into last week, with .cs and .js files trying to talk to each other.

    Here is the link to the Script Compilation in the documentation.

    Perhaps it may help, if not in this situation, than in later ones. Hopefully it'll shed light onto a solution which won't require you to constantly uninstall, reinstall.
     
  5. Factoid

    Factoid

    Joined:
    Mar 30, 2008
    Posts:
    69
    The script compilation order I'm quite familiar with, but it's really random to have scripts start complaining about RPC calls (especially since the rpc calls are local to the script, and in some instances those scripts don't rely on other scripts at all) when 'nothing' has been done to them.

    Of course things are changing in the project all the time, but nothing I can get a direct cause and effect relationship out of yet.
     
  6. horsman

    horsman

    Joined:
    Jul 19, 2008
    Posts:
    156
    I've not been able to track this one down. I'm not using any JS code in my game.

    Edit:

    it happens if you ever have a script that has a classname that is not the filename (since 2.6)
     
  7. riadsala

    riadsala

    Joined:
    Feb 10, 2010
    Posts:
    15
    Hello,

    any more info on how to fix this error? I've started getting it and I have no idea why I've started getting it :(
     
  8. AgainstTime

    AgainstTime

    Joined:
    Apr 14, 2010
    Posts:
    84
    if u'r integrating with JS and C# scripts, put the C# script in the Standard Assets folder.
     
  9. riadsala

    riadsala

    Joined:
    Feb 10, 2010
    Posts:
    15
    I'm not... I think I might be using one C# script (to create a two dimensional array) and that's already in the standard asset folder. And isn't used with the RPC script in question anyway... I can post up the code when I get home if that helps...?

    it's an infuriating problem

    any other suggestions?



     
  10. DaveA

    DaveA

    Joined:
    Apr 15, 2009
    Posts:
    280
    Did you ever get this figured out?
     
  11. hscheirich

    hscheirich

    Joined:
    Nov 17, 2010
    Posts:
    5
    I saw the same error within a pure c# project, the issue in my case was that there was another function within another behavior that had the same name, the documentation states that the name of the called method has to be unique accross all behaviors, otherwise another function might get called. If this other function does not have the RPC Attribute set you will see the totally unhelpful error message

    see http://unity3d.com/support/documentation/ScriptReference/NetworkView.RPC.html
     
    Bamdad likes this.
  12. foxter888

    foxter888

    Joined:
    May 3, 2010
    Posts:
    530
    somnetimes it won't work too because you probably need a networkview that doesn't watches anything and nothing for the syncronization
     
  13. Bamdad

    Bamdad

    Joined:
    Aug 29, 2016
    Posts:
    1
    Wow thanks, that was my problem solution! I had a StartGame function in one of my scripts, and I had it in another one with [RPC] too, there was errors for RPC even when the first script was not in the scene! I renamed it and it`s solved now, thanks