We are trying to make an mmo(possibly rpg) and so far we have a simple map, targetting, and seeing the other player works fine. The issue comes up with getting a random cube we have spawned to disappear through the network. We have tried getting it to disappear through network.destroy(gameObject); and had no luck. We then attempted an rpc call and were thwarted with the error:
Can’t send RPC function since no connection was started.
UnityEngine.NetworkView:Internal_RPC(NetworkView, String, RPCMode, Object[ ])
UnityEngine.NetworkView:Internal_RPC(NetworkView, String, RPCMode, Object[ ])
UnityEngine.NetworkView:RPC(String, RPCMode, Object[ ])
Kaboomlol:OnMouseDown() (at Assets/Kaboomlol.js:4)
Here is the code we tried:
var HP=50;
function OnMouseDown () {
networkView.RPC (“Dead”, RPCMode.All, “RPC Recieved”);
}
@RPC
function Dead (text : String){
WorkingGui.TargetSet=0;
Network.Destroy(gameObject);
Debug.Log(text);
}
We have tried a few other ways but with no success. We are just looking for a simple way to destroy an object that all clients will be able to see has been destroyed.