Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Unsupported enum type 'UnityEngine.Networking.Types.NetworkID'

Discussion in 'Connected Games' started by Chris_Entropy, Oct 6, 2015.

  1. Chris_Entropy

    Chris_Entropy

    Joined:
    Apr 11, 2011
    Posts:
    172
    Every time I use the NetworkID enum type in any C# script (namespace UnityEngine.Networking.Types), my console is flooded with the following error:
    Unsupported enum type 'UnityEngine.Networking.Types.NetworkID' used for field '<variable name>' in class '<class name>'

    It does not seem to interfere with any functionality, but it clutters the console. Is there a way around it?
     
  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    this is a known bug.. 711764
     
  3. Chris_Entropy

    Chris_Entropy

    Joined:
    Apr 11, 2011
    Posts:
    172
    Can it be workarounded by storing the value in a ulong? Or will this cause some information to go missing?
     
  4. JeremyUnity

    JeremyUnity

    Unity Technologies

    Joined:
    Mar 4, 2014
    Posts:
    147
    That's the best work around right now. The issue is Unity's enum serializer expects a 32bit value only, but the underlying type for NetworkID is a ulong
     
  5. Chris_Entropy

    Chris_Entropy

    Joined:
    Apr 11, 2011
    Posts:
    172
    Ok, thanks.
     
  6. mikef

    mikef

    Joined:
    Apr 2, 2009
    Posts:
    56
    Hi, i've just run into this issue, how do you go about converting the value to a ulong so as to avoid these errors?
     
  7. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    975
    ulong value = (ulong) intValue?

    Typecasting?
     
  8. Chris_Entropy

    Chris_Entropy

    Joined:
    Apr 11, 2011
    Posts:
    172
    I store it in a variable of type ulong instead of a NetworkID.

    so for example:
    ulong networkIdUlong = (ulong) actualNetworkId;

    Since I only need it for comparison, I never make a cast back to NetworkID, I don't know if this would work without error. But the errors seem to be irrelevant anyway, since there do not seem to be any bugs in the actual game.
     
  9. mikef

    mikef

    Joined:
    Apr 2, 2009
    Posts:
    56
    Thanks Chris, much appreciated!
     
  10. AllFatherGray

    AllFatherGray

    Joined:
    Nov 29, 2014
    Posts:
    8
    Any ETA on when 64 bit support will be added? I'd like to be able to back my enums with long/ulongs.
     
  11. gresolio

    gresolio

    Joined:
    Jan 5, 2014
    Posts:
    17
    Another workaround for 64bit value enum:
    just add [NonSerialized] attribute to your field
     
  12. haouari

    haouari

    Joined:
    Jun 1, 2016
    Posts:
    3
    add
    [System.NonSerialized]
    that [NonSerialized] didn't work for me
     
  13. haouari

    haouari

    Joined:
    Jun 1, 2016
    Posts:
    3
    but weird error popout when i do that
     
unityunity