unity-game-engineunity3d-unet

Unet Unity islocal player error


I am testing out the Unet multiplayer functionality on a basic 2d game. At the moment it consists of a single box/racket moving up and down. In the monobehaviour class the box moves up and down correctly, however when i include the islocalplayer in the networkbehaviour class the box does not move up and down. When I play the game the network information box says islocal no. How do i go about changing this. enter image description here

using UnityEngine;
using UnityEngine.Networking;

public class MoveRacket : NetworkBehaviour
{
  public float speed= 30;
  public string axis = "Vertical"; 

  void Update()
  {

    if (!isLocalPlayer)
    {
       return;
    }

    float v = Input.GetAxisRaw(axis);
    GetComponent<Rigidbody2D>().velocity = new Vector2(0, v) * speed;
  }

}

Solution

  • ok got it in the network manager game object > spawn information > check auto create player