Search Unity

Third Party Mirror: Player object is not a player

Discussion in 'Multiplayer' started by NamelessGames_, Apr 15, 2020.

  1. NamelessGames_

    NamelessGames_

    Joined:
    Jun 4, 2019
    Posts:
    43
    Hi guys,
    when my PlayerPrefab launch this code
    Code (csharp):
    1. public override void OnStartLocalPlayer () {
    2.         base.OnStartAuthority ();
    3.         Vector3 spawnPos = _spawnPos;
    4.         if (GetComponent<CameraMovement>().num == 1) spawnPos = _spawnPos + new Vector3(47, 0, 0);
    5.         NetworkServer.Spawn(Instantiate(_basePrefab, spawnPos, Quaternion.identity), gameObject);
    6.     }
    it raises me this error:
    Player object is not a player.
    UnityEngine.Debug:LogError(Object)

    Do you know why and what does it mean?
    Thank you!
     
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Take a step back and read through our documentation.
    You are trying to call server functions from the client, which won't work.
     
    Joe-Censored likes this.