Search Unity

Third Party 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,847
    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
     
  4. BlindSoulYT

    BlindSoulYT

    Joined:
    May 9, 2022
    Posts:
    1
    Watch Carefully, I had the same problem when i checked the package manager i forgot to import the mirror in my project. I imported the mirror in my project then my problem is fixed.

    Thanks :)

    YouTube: Blind Soul