Network.Instantiate

hello guys i triying spawning two players but if i spawn look what happen. if u need myscript i can upload just tell me if u can help me

Could you post what you’ve done?

OK

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Networking : MonoBehaviour
{
    //Formularios
    public InputField username;
    public InputField password;
    public InputField regUsername;
    public InputField regPassword;
    public InputField regRepeatPassword;
    public InputField email;
    public InputField numberInput;
    public Text message;
    public Text generatedNumber;
    private int randomNumber;

    //Menu Actual
    private string _CurrentMenu = "MenuLogin";

    //Desactivo GameObjects
    public GameObject menuLogin;
    public GameObject menuRegister;

    //Server Status AREA!
    public Text serverStatus;
    public GameObject menuLoginButton;

    //Chequea si tiene personaje
    private int existCharacter;
   
    public static int UserID;

    void Start()
    {
        currentMenu ();
        message.text = "";
    }

    void Update()
    {
        ServerCheck ();
        currentMenu ();
    }

    private void currentMenu()
    {
        if (_CurrentMenu == "MenuLogin")
        {
            menuLogin.gameObject.SetActive(true); // Activo Script menuLogin
            menuRegister.gameObject.SetActive(false); // Desactivo Script menuRegister

            ServerCheck();
        }

        if (_CurrentMenu == "MenuRegister")
        {
            menuLogin.gameObject.SetActive(false); // Desactivo Script menuLogin
            menuRegister.gameObject.SetActive(true); // Activo Script menuRegister
       
            generatedNumber.text = randomNumber.ToString();

        }
    }

    public void loadLogin ()
    {
        _CurrentMenu = "MenuLogin";
        message.text = "";
        currentMenu ();
    }

    public void loadRegister ()
    {
        _CurrentMenu = "MenuRegister";
        randomNumber = Random.Range(1000,99999);
        regUsername.value = "";
        regPassword.value = "";
        regRepeatPassword.value = "";
        email.value = "";
        numberInput.value = "";
        message.text = "";
        currentMenu ();
    }

    public void regCheck()
    {
        message.text = "";   
        if(regUsername.value == "" || email.value == "" || regPassword.value == "" || numberInput.value == "0"){
            message.text += "Please fill in the empty fields. \n";
        }else{
            if(regPassword.value == regRepeatPassword.value){
                if(numberInput.value == generatedNumber.text){
                    StartCoroutine("doRegister");
                }else{
                    message.text += "The number you inputed is not the same number.";
                }
               
            }else{
                message.text += "The passwords do not match. \n";
            }
        }
    }

    public void logCheck()
    {
        if(username.value == "" || password.value == ""){
            message.text += "Please enter the necessary data! \n";
        } else{
            message.text = "";
            StartCoroutine("doLogin");
        }
    }

    private void ServerCheck()
    {
        StartCoroutine (ServerRefresh ());
               
        if(MasterServer.PollHostList().Length != 0)
        {
            HostData[] data = MasterServer.PollHostList();
            foreach(HostData c in data)
            {
                serverStatus.text = c.gameName + " " + (c.connectedPlayers - 1) + "/" + c.playerLimit;
                menuLoginButton.gameObject.SetActive(true); // Activo Script menuLoginButton
            }
        }
        else
        {
            serverStatus.text = "Server Offline";
            menuLoginButton.gameObject.SetActive(false); // Desactivo Script menuLoginButton
        }
    }

    public void OnConnectedToServer()
    {
        networkView.RPC("LoginRPC",RPCMode.All, username.value, Network.player);

        LevelManager.Load ("LoadingData", 0f);
    }
   
    private void OnDisconnectedFromServer()
    {
        _CurrentMenu = "MenuLogin";
    }
   
    private IEnumerator doRegister()
    {
        WWWForm form = new WWWForm();
        form.AddField("Username" , regUsername.value);
        form.AddField("Password" , regPassword.value);
        form.AddField("Email" , email.value);           
        var w = new WWW(Info.webSite + "/Register.php", form);           
        yield return w;
        if(w.error == null){
            message.text += w.text;

            yield return new WaitForSeconds(2);

            _CurrentMenu = "MenuLogin";

            StopCoroutine("doRegister");
        }else{
            message.text += "Error : " + w.error + "\n";
        }
    }
    private IEnumerator doLogin()
    {
        WWWForm logform = new WWWForm();
        logform.AddField("Username" , username.value);
        logform.AddField("Password" , password.value);
        var logw = new WWW(Info.webSite + "/Login.php", logform);
        yield return logw;
        if(logw.error == null){
            message.text += logw.text;
           
            StopCoroutine("doLogin");
        }else{
            message.text +="Error : " + logw.error + "\n";   
        }
        if(message.text == "Login success! Please wait while the game loads..."){
            Network.Connect("avct.sytes.net", 8632);
        }
    }
   
    private IEnumerator ServerRefresh()
    {
        yield return new WaitForSeconds(3);
        MasterServer.RequestHostList("MMOFPS");
    }

    [RPC]
    public void LoginRPC(string username,NetworkPlayer player)
    {
        Info.Owner = username;
    }
}
using UnityEngine;
using System.Collections;

public class GameStarted : MonoBehaviour {

    private const string MALE_MODEL_PATH = "Characters/Male/";
    private const string FEMALE_MODEL_PATH = "Characters/Female/";
    public string[] maleModels;
    public string[] femaleModels;

    private int _index = 0;
    public GameObject playerPref;


    void OnServerInitialized()
    {
        //SpawnPlayer();
    }
   
    void OnConnectedToServer()
    {
        //SpawnPlayer();
    }
    // Use this for initialization
    void Start () {

        if(Info.charGender == 0)
        {
            playerPref = Network.Instantiate (Resources.Load (MALE_MODEL_PATH + maleModels[ _index ]), new Vector3(Info.charPosX, Info.charPosY, Info.charPosZ), transform.rotation, 0) as GameObject;
        }
        else if(Info.charGender == 1)
        {
            playerPref = Network.Instantiate (Resources.Load (FEMALE_MODEL_PATH + femaleModels[ _index ]), new Vector3(Info.charPosX, Info.charPosY, Info.charPosZ), transform.rotation, 0) as GameObject;
        }


    }
}

Are you calling Network.RemoveRPCs anywhere?

Your second problem can be fixed by localizing input that’s received (nothing to do with your scripts above). Currently, if you look at your hierarchy at runtime, you should see both characters have there movement scripts enabled? If so, you can fix this by disabling them on remote players as they connect, or checking that any input received is only executed on the local client.

i called RemoveRPCs if disconnected from server. and u can fix my script? or this scrit is good?

Could you post the method which calls it? I couldn’t see anything wrong with your samples above.

u say server?

Could you post the RemoveRPCs line in your script?

if u want i can give u remote acces with Teamviawer.

My server script:

using UnityEngine;
using System.Collections;

public class Server : MonoBehaviour
{
    //Server Info
    public string ServerName;
    public string ServerDesc;
    public string ServerPort = "8632";
    public string maxPlayers;
   
    private bool Online = false;
   
    private void OnServerInitialized()
    {
        Online = true;
    }
   
    private void OnDisconnectedFromServer()
    {
        Online = false;
    }

    void OnPlayerDisconnected(NetworkPlayer player)
    {
        //Remove the buffered RPC call for instantiate for this player.
        int playerNumber = int.Parse(player+"");
        Network.RemoveRPCs(Network.player, playerNumber);

        // The next destroys will not destroy anything since the players never
        // instantiated anything nor buffered RPCs
        Network.RemoveRPCs(player);
        Network.DestroyPlayerObjects(player);
    }
   
    private void OnGUI()
    {
        if(!Online)
        {       

            GUI.Box(new Rect(Screen.width / 2 - 170, 20, 350, 150), "");

            GUI.Label(new Rect(Screen.width / 2 - 160, 30, 200, 20), "Server Name: ");
            GUI.Label(new Rect(Screen.width / 2 - 160, 55, 200, 20), "Max Players: ");
            GUI.Label(new Rect(Screen.width / 2 - 160, 80, 200, 20), "Server Port: ");
            GUI.Label(new Rect(Screen.width / 2 - 160, 105, 200, 20), "Server Description: ");

            ServerName = GUI.TextField(new Rect(Screen.width / 2 - 40, 30, 200, 20), ServerName, 25);
            maxPlayers = GUI.TextField(new Rect(Screen.width / 2 - 40, 55, 200, 20), maxPlayers, 25);
            ServerPort = GUI.TextField(new Rect(Screen.width / 2 - 40, 80, 200, 20), ServerPort, 25);
            ServerDesc = GUI.TextField(new Rect(Screen.width / 2 - 40, 105, 200, 20), ServerDesc, 25);
           
            if (GUI.Button(new Rect(Screen.width / 2 - 100, 140, 200, 20), "Start Server"))
            {
                Network.InitializeSecurity ();
                Network.InitializeServer(int.Parse(maxPlayers) - 1, int.Parse(ServerPort), !Network.HavePublicAddress());
                MasterServer.RegisterHost("MMOFPS", ServerName, ServerDesc);
            }
        }
        else
        {
            GUI.Box(new Rect(Screen.width / 2 - 170, 20, 350, 150), "");
            if(GUI.Button(new Rect(Screen.width / 2 - 90, 30, 200, 20), "Disconnect"))
            {
                Network.Disconnect();           
            }
            GUI.Label(new Rect(Screen.width / 2 - 160, 55, 200, 20), "Connections: " + Network.connections.Length.ToString () + "/" + maxPlayers.ToString());
           
        }
    }
}

i can give u remote access if u want?