Beispiel #1
0
    public void CmdSpawnTargetForPlayer(int _targetChara)
    {
        GameObject charNew           = cs.GetTargetCharacter(_targetChara);
        GameObject charInstantianted = Instantiate(charNew, transform.position, Quaternion.identity) as GameObject;

        Debug.Log(charInstantianted);
        Debug.Log(nd.connectionToClient);

        /*
         * NetworkServer.Spawn(charInstantianted);
         * charInstantianted.GetComponent<NetworkIdentity>().AssignClientAuthority(nd.connectionToClient);
         */

        // NetworkServer.SpawnWithClientAuthority(charInstantianted, nd.connectionToClient);

        NetworkServer.AddPlayerForConnection(nd.connectionToClient, charInstantianted, 0);

        playerChar = charInstantianted;
        Debug.Log(playerChar);
    }