Search Unity

NetworkBehaviour is obsolete CS0618

Discussion in 'Scripting' started by RamGuyy, Aug 6, 2019.

  1. RamGuyy

    RamGuyy

    Joined:
    Aug 6, 2019
    Posts:
    2
    I've heard that UNet is going to be replaced or is already replaced i'm not sure, im kinda new to unity. But anyways to the question that i have.

    So i have a simple script that is mean't to make the player able to move the player object. But it gives me this error CS0618 and the script won't work at all im not sure if that is why it doesn't work or if it's something else.

    Is there anything else i could use instead of NetworkBehaviour at the moment?

    Thanks!

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Networking;
    5.  
    6. public class Player : NetworkBehaviour
    7. {
    8.    
    9.     void Update()
    10.     {
    11.       if (isLocalPlayer == true)
    12.         {
    13.             if (Input.GetKey(KeyCode.D))
    14.             {
    15.                 this.transform.Translate(Vector3.right * Time.deltaTime * 3f);
    16.             }
    17.         }  
    18.     }
    19.  
    20.  
    21. }
     
  2. RamGuyy

    RamGuyy

    Joined:
    Aug 6, 2019
    Posts:
    2
    UPDATE*

    the warning message is gone after updating to the latest update of unity.
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Unity has a new network system with an alpha release on github. The documentation borders on non-existent. You can find the link in one of the relevant threads over in the connected games forum.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    The developer of uMMORPG maintains a UNet replacement called Mirror. Until Unity's new networking package has documentation, is fully tested, etc., Mirror is a good option because it has the same API as UNet so you can rely on all of the existing UNet tutorials.