I have a Problem with an RPC-Call, where an Enemy should be called on the Server-Side. Here is the Code:
function Awake() { wallWalker = Resources.Load("WallWalker") as GameObject; spawnWallWalker(); } function resetOther() { if (spawn) { GameObject.Destroy(spawn); } spawnWallWalker(); } function spawnWallWalker() { if (Network.peerType != NetworkPeerType.Disconnected) { //Only Spawn Wallwalker on Server networkView.RPC("spawnWallWalkerRPC", RPCMode.Server); } else { spawnWallWalkerRPC(); } } @RPC function spawnWallWalkerRPC() { if (Network.peerType != NetworkPeerType.Disconnected) { spawn = Network.Instantiate(wallWalker, transform.position, Quaternion.identity, 0);` } else { spawn = GameObject.Instantiate(wallWalker, transform.position, Quaternion.identity); } spawn.GetComponent(WallWalker).spawn(transform.position, horizontalMax, verticalMax); }
Everything works fine, except after networkView.RPC("spawnWallWalkerRPC", RPCMode.Server);
the Function spawnWallWalkerRPC
is not called, and Unity does not display an Error.
I really have no Idea where the problem lies, maybe I’m missing something obvious. Help is very much appreciated.