Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Mirror NetworkBehaviour - Please change script to derive from MonoBehaviour Error

Discussion in 'Multiplayer' started by Kiesco91, Jan 30, 2021.

  1. Kiesco91

    Kiesco91

    Joined:
    Aug 20, 2018
    Posts:
    80
    Hello,

    im trying to make an online multiplayer game in Unity using Mirror. It's my first time using Mirror so still getting to grips with it but so confused with this error.

    im trying to create a script for a Lobby player called NetworkRPL (Network room player lobby). I have attached it to my empty game object along with a Network identity but when I try to create a prefab of this object, I get an error saying I need to change my script to derive from : MonoBehaviour and not : NetworkBehaviour.

    I have uploaded some photos for reference.

    I have also tried name changes, spelling checks, even copy and pasting the same thing but its still giving me errors so that isn't the issue.

    thanks,
     

    Attached Files:

  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,821
    You mention "errors" plural. What are the other errors besides the one you posted? My wild guess is you have some other compile error somewhere in the project.
     
  3. Zyrcox

    Zyrcox

    Joined:
    Jan 7, 2013
    Posts:
    10
    i had the same problem, unity don't recognize networkbehaviour as derive from monobehaviour so can't add the script to object
     
unityunity