x


RPC Call error

openableDoor1.js

if(correct)
       {
         R01aa.active = true;    // Set gameobject to active
         MoveAround.rad1a = false;
         //choice = false;
         score1 = score1 +100;
         networkView.RPC("updateScores", RPCMode.Server, score1);
       }

//server @RPC

function updateScores(player: NetworkPlayer, nScore : int)
{
    print("I am inside gamesetup updateScores RPC");
    var newEntry : FPSPlayerNode = new FPSPlayerNode();

    newEntry.playerName=name;
    newEntry.score = nScore;
    playerList.Add(newEntry);

    networkView.RPC("UpdateScore", RPCMode.AllBuffered, player, nScore);

}

RPC call failed because the function 'updateScores' does not exist in the any script attached to'Door1'.

I don't know what the problem with it. Please help

more ▼

asked Mar 23 '12 at 09:43 AM

missypooh gravatar image

missypooh
77 32 48 50

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Dont you need a reference to the script which contains the RPC you want to send? like this:

GameObject go = GameObject.Find("fooObject"); //Gameobject which
                                              //holds the script with the RPC
fooScriptClassName bm = go.GetComponent<fooScriptClassName>();

go.networkView.RPC("UpdateScore", RPCMode.AllBuffered, player, nScore);

And are RPCs not in this style:

[RPC]
void foobar(foo foooovar)
{
}

i hope this helps :)

greets chain

more ▼

answered Mar 23 '12 at 03:34 PM

Chain gravatar image

Chain
16 1 1 2

Hmm... Actually i am not very familiar with RPC call. Basically i am using M2H networking tutorial example4 (FPS setup) for my games. So now basically i want to update the score table. But somehow it doesn't go the way i want it to be like. I will post another question on it. so please help too. :) thanks

Mar 23 '12 at 03:54 PM missypooh
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x250
x121

asked: Mar 23 '12 at 09:43 AM

Seen: 711 times

Last Updated: Mar 23 '12 at 03:54 PM