![]() If it is just for the RPC function, state synchronization should be turned off and the observed property can be set to none. ![]() It doesn't matter if the NetworkView is being used for something else or just for the RPC function. How do you tell the networkView that the RPC should be executed on the Director instead? yields the same result. A NetworkView must be attached to the GameObject where the RPC function is being called.The networkView.RPC call and the function are in the same script file.For some reason the RPC tries to execute for scripts attached to GameDirector rather than for Director.That way you can just look at another player and see their health bar. In my game, the characters have health bars over their heads that are supposed to update for the entire server. These queries are started when the GameDirector calls kDirector.DoneLoading() at the end of the Start() function of the logic script in GameDirector Viewed 944 times 1 I'm having a difficult time getting my health bar to sync through the server on Unity using RPCs. ⢠The function for the RPC is inside a script of Director NetworkView nv TM.GetComponent() nv.RPC('getscore',RPCMode.All,25) Solution 2: You can add the following attribute at the beginning of your script class: RequireComponent (typeof (NetworkView)) This will ensure that whenever your script is added to a GameObject, a networkviewcomponent will also be added to that GameObject.So when the player has received "IAmReady" from all other players then its time to start the game. So I send out an RPC to all players when they have loaded. The problem I am having is that when the two players connect to eachother and start the game I need to make sure that both players have loaded the scene before I start instantiating the player characters (otherwise the Network.Instantiate will just get lost if a client is still loading). The other is called Director and this game object manages the communications to the master server and keeps track of the players and a bunch of other stuff that gives as little networking overhead as possible to the minigames so one can churn them out fast. A typical SDK user (Unity developer) can declare multiple RPCs under a NetworkBehaviour and inbound/outbound RPC calls will be replicated as a part of its replication in a network frame. One is called GameDirector which manages the logic for the current scene that is loaded (I am basically doing a bunch of multiplayer minigames). RPC call failed because the function 'IAmReady' does not exist in any script attached to'GameDirector'
0 Comments
Leave a Reply. |