Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Bug UnetTransport can't get serialized; workaround didn't work either

Discussion in 'Netcode for GameObjects' started by StarManta, Jun 2, 2021.

  1. StarManta


    Oct 23, 2006
    I'm playing with my first attempt at a MLAPI test project, and I can't get through the first part of the tutorial without hitting the bug described here. I'm using 0.1.0 and 2020.1.0f1.

    I tried what I thought was going to be a clever workaround. I dragged UnetTransport out of the package into my project folder, renamed it (and the class) to UnetTransportCustom, and commented out a line with compile errors:
    Code (csharp):
    2. Assets\UNetTransportCustom.cs(295,36): error CS0117: 'NetworkLog' does not contain a definition for 'CurrentLogLevel'
    3. Assets\UNetTransportCustom.cs(295,82): error CS0117: 'NetworkLog' does not contain a definition for 'LogError'
    I'm not sure why it wasn't reporting a compile error when it was in the package, but I guessed that this error was the reason it wouldn't serialize the component. So after fixing the error and assigning this new component to my NetworkManager, I hit play and.... same exact problem. If I try to manually add the component, I get:
    (There are no compiler errors and the names match)

    What gives? Is there a workaround?

    I've looked at this error and I'm not seeing any way that this package as published could ever possibly not generate this compiler error (it's not referencing some minor Unity builtin class that could change between versions, it's referencing another class in the same package, and that class doesn't have the members it needs), so how is it that this forum isn't flooded with people having this exact same problem? How is ANYONE getting this package to work? It's a preview package, bugs are to be expected of course, I just don't understand how this bug can.... exist.... and not be literally the only thing being discussed about using this package, because it makes the package fundamentally impossible to use?

    I am so perplexed.
    Last edited: Jun 2, 2021
  2. StarManta


    Oct 23, 2006
    UPDATE: OK, some combination of Unity Hub bug and/or unobservantness on my part caused me to think I was in 2021.1 when I was actually in 2020.1; opening it in 2021.1 fixed the issue.

    That said it fixed the issue in a way that completely baffles me. I opened up the package's Logging/NetworkLog.cs (the one that was lacking members causing the above compile errors) to see what was up and.... it's a DIFFERENT FILE. It has COMPLETELY different contents than what I was seeing when I wrote the post above. How did changing my Unity version change my package contents? I continue to be perplexed. But I am at least now, perplexed without being entirely blocked on my test project.