RPC isn't called on objects with another name, even though they have the same script.


I have an object that has a script. The script calls a remote procedure call on itself, but only on object where the name hasn’t been modified. How can I fix this?

Thanks in advance.

All of the examples below are in the same script.

    void Update()
        //Let's send RPC calls to all the other players.
        networkView.RPC("DoSomething", RPCMode.Others);
    //This is supposed to be called on all objects with this script.
    void DoSomething()
        //This only gets called on objects with the default name, and not on objects with modified names.
        Debug.Log("Prefab is doing something!");

NOTE: All of this is in one script, but it doesn’t get called on objects that don’t have the default name.


In the description: A NetworkView must be attached to the GameObject where the RPC function is being called.

Do you have a NetworkView attached?

In the description: if two RPC functions in different scripts have the same name only one of them is called when RPC is invoked.

Maybe that’s the problem.

You might also want to try changing the RPCMode and see if it makes any diffrence.