Background: In my game the user is presented with the multi-player menu. They select if they want to join or host a game (client vs server respectively). Upon choosing, I instantiate either a GameServer or GameClient prefab I created. These two objects are basically mirrors of one another and handle things like synching level loading and adding/dropping players etc, all via RPC. These two objects exist during gameplay as well (otherwise if a player is dropped we would miss his object being destroyed etc).
The problem: When I instantiate a player prefab once the levels are loaded on client and server, the player receives RPC calls from the server however the RPC does not exist in any scripts attached to the player. An easy example to illustrate is one player is an a match alone. A new player joins, he loads the level and gets his prefab instantiated. The clients and server exchange some info via RPC to share player name, color etc. however those RPC calls do not exist in any scripts on the player prefab( which has a network view for sending gamestate data).
Now the pain in my a$$ Ok so why don’t I just add a blank stub for the RPC call to a script on my player object so I dont get a failed RPC exception? Well now we have two RPCs that are not unique across the scene and the blank stub can get called which does nothing.
What is the solution? What is Unity’s methodology for this type of situation (maybe I am misusing RPCs or is there a way to force an RPC to go to particular gameobject and not all gameobjects on a given client)? Thanks in advance - R