Hi,
I got a script from the Multiplayer tutorial, but it won’t let me do what I need to. It says I need to set a prefab to a variable, but I can’t access the variable from the inspector. The code is:
function OnPlayerDisconnected (player : NetworkPlayer)
It says I’m supposed to set player to a prefab, but it doesn’t show up on the inspector. Any ideas?
What it means is probably that you need to have a prefab as a variable:
var myPrefab : NetworkPlayer;
And you need to use that to call the function:
OnPlayerDisconnected(myPrefab);
It still won’t show up on the inspector. I copied the script directly from the Multiplayer Tutorial. This is the whole thing:
var SpaceCraft : Transform;
function OnNetworkLoadedLevel ()
{
// Instantiating SpaceCraft when Network is loaded
Network.Instantiate(SpaceCraft, transform.position, transform.rotation, 0);
}
function OnPlayerDisconnected (player : NetworkPlayer)
{
Network.RemoveRPCs(player, 0);
Network.DestroyPlayerObjects(player);
}