Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug Network Object Script not compiling

Discussion in 'Netcode for GameObjects' started by ParsyXD, Mar 6, 2024.

  1. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    hey, i am using netcode for gameobjects but the network object script is not compiling / loading
    (no console errors i am sure) version 1.8.1

    Bild_2024-03-15_235826821.png Bild_2024-03-15_235854798.png Bild_2024-03-16_000013863.png
     
    Last edited: Mar 16, 2024
  2. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,166
    that would suggest there is a networkobject script of emptyness about
     
  3. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    what?
     
  4. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,166
    if there truly are no errors.. the only answer can be that you have made a script called NetworkObject which has no visible inspector fields hence, its "empty"
     
  5. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    no. only one script. it doesn't show up in the add component - netcode category, but i can add it per script to an object, it disappears if i hit save prefab tho, after that it's a missing script or empty like the picture
     
  6. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    Check if you disabled console display of errors or warnings to be sure there aren't any errors.
    If NetworkObject is not shown under Add Component it's very likely that you do have errors.

    Also it matters where you add the NetworkObject. It needs to be at the root of a prefab. I believe it deletes itself if it isn't.
     
  7. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    1. no i don't have any errors
    2. i know
     
  8. I_LoveBoxes

    I_LoveBoxes

    Joined:
    Aug 2, 2023
    Posts:
    5
    I just got this error right after upgrading to 1.8.1 ... any solutions? I was really excited to use the Rpc feature (rather than ServerRpc/ClientRpc) and then I got hit by this and I can't find anything... exact same visually as the screenshots *edit* this also happens with the Unity Transport
     
    Last edited: Mar 19, 2024
  9. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    i made a unity support request but no reply for a week, idk what else to do
    however if you find a solution tell me pls :)
     
  10. I_LoveBoxes

    I_LoveBoxes

    Joined:
    Aug 2, 2023
    Posts:
    5
    HEY! Great news; after banging my head against a brick wall for hours and reinstalling, copy/pasting, testing, and pure emotional turmoil I did fix it!

    My solution: Uninstall and reinstall packages. I am using Facepunch transport so I had to uninstall many packages including NCGO, said Facepunch transport, and multiplayer tools, restarted several times, reinstalled the packages and everything works now (I think, came here immediately to tell you). One small hiccup, this reinstall/cleanup process somehow broke probuilder so I had to reinstall that too. Really not sure of the exact issue, but I think upgrading to 1.8.1 somehow broke several files (it also broke the Unity Transport for me), but a lot of reinstalls and restarts seemed to fix it. I would say just try to do things each step at a time and see what fixes or breaks... I really didn't want to resort to reinstalling stuff because that can break things (like pro-builder for some reason), but I got fed up and it worked.

    But yeah I guess just lmk if that fixes it for you, if not... well either way this is probably the weirdest problem I've had with Unity (second place going to all Network Objects having their global IDs broken and having to take off and put back on new NO components... Netcode is truly the bane of my existence).
     
  11. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    ok gotta try that and uninstall all networking stuff even tho i am only using unity's
     
  12. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    yeah so i tried and still nothing
     
  13. I_LoveBoxes

    I_LoveBoxes

    Joined:
    Aug 2, 2023
    Posts:
    5
    Damn bro, sorry- this is way out of my expertise... My only followup would be this: are you 100% sure that netcode was fully uninstalled? I had something that listed Netcode as a prerequisite, so I had to do a deep clean... Also check if it works in a new project with 1.8.1 (it did for me which is what led me to my clean reset solution)... if none of that helps, then my best guess would be a script conflict like suggested above, but if that doesn't work then good luck with your support ticket... seeing some of the Netcode issues you will need it.
     
  14. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    wdym with "I had something that listed Netcode as a prerequisite" ?
    also i don't know how to create a fresh project (which files to transfer and which not)
     
  15. I_LoveBoxes

    I_LoveBoxes

    Joined:
    Aug 2, 2023
    Posts:
    5
    1. I meant dependency, not prerequisite, my bad... (so for me it was Facepunch, but if you were just using NCGO and Unity transport then this might not apply - for example a lot of packages list burst as a dependency so to uninstall burst you have to remove those packages first
    2. I just mean make a fresh project and make sure that netcode for GOs 1.8.1 works (nothing imported from your current project, just a brief test) - this step probably isn't needed, it's just what led me to clean as much of the project code as I could. (reinstalling and restarting) (the thought process was that if it worked in a fresh project (which it did), then it was some corruption somewhere and I couldn't find any scripts that were messing with it so I just reinstalled and restarted several times between)

    Sorry I can't give any concrete methods; I have no real software engineering skills I just mess around with Unity in my free time
     
  16. ParsyXD

    ParsyXD

    Joined:
    May 12, 2020
    Posts:
    16
    ok it works (right now) looks like the problem was unity relay (transport)
     
    I_LoveBoxes likes this.
  17. I_LoveBoxes

    I_LoveBoxes

    Joined:
    Aug 2, 2023
    Posts:
    5
    GGs, good luck not getting some random error like this in future