Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

NetCode SerializeValue pre0.9 "Can't Serialize using FixedString32Bytes"

Discussion in 'Documentation' started by AnisTKaram, May 18, 2022.

  1. AnisTKaram

    AnisTKaram

    Joined:
    Jul 16, 2020
    Posts:
    6
    I'm trying to save a string as a network variable, but as you know in NetCode, a string is not supported, so we need to Serialize. I saw a video on youtube he did the same thing but it doesn't work for me.
    Here is the error: There is no boxing conversion from "Unity.Collections.FixedString32Bytes" to "System.IConvertible".
    Thank you!

    upload_2022-5-18_22-59-56.png
     
    alinajosephclass likes this.
  2. oivanov

    oivanov

    Joined:
    Apr 22, 2021
    Posts:
    2
  3. AnisTKaram

    AnisTKaram

    Joined:
    Jul 16, 2020
    Posts:
    6
  4. oivanov

    oivanov

    Joined:
    Apr 22, 2021
    Posts:
    2
    Probably you are displaying in the overlay object
    ForceNetworkSerializeByMemcpy<FixedString32Bytes>
    , like:

    Code (CSharp):
    1. private ForceNetworkSerializeByMemcpy<FixedString32Bytes> _info;
    2. overlay.SetText(_info.ToString());
    Try to use
    _info.Value.ToString()
    :
    Code (CSharp):
    1. overlay.SetText(_info.Value.ToString());
     
  5. AnisTKaram

    AnisTKaram

    Joined:
    Jul 16, 2020
    Posts:
    6
    Thanks!