Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

NetworkVariable/Int/String etc

Discussion in 'Multiplayer' started by cerestorm, Nov 10, 2021.

  1. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    118
    I'm just trying out Netcode for the first time and I'm struggling with network variables. I see references to NetworkVariableInt etc but can't declare them, have these been removed?

    I was going to check the release notes but the link in the sticky is broken.
     
  2. luke-unity

    luke-unity

    Unity Technologies

    Joined:
    Sep 30, 2020
    Posts:
    255
    NetworkVariableInt etc. no longer exist. You can use NetworkVariable<int> now etc. For string you have to use NetworkVariable<FixedString64>. Which sticky thread contains the broken links?
     
  3. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    118
    luke-unity likes this.
  4. luke-unity

    luke-unity

    Unity Technologies

    Joined:
    Sep 30, 2020
    Posts:
    255
    Thanks, there is already a PR up to fix the documentation page. So hopefully the page will be updated soon with the updated information.
     
    cerestorm likes this.
  5. VincentAbert

    VincentAbert

    Joined:
    May 2, 2020
    Posts:
    110
    Hi, I just wanted to say that the documentation (as far as I can tell) is still outdated, and it makes working with MLAPI quite tough... Has there been change to use string network variables by the way ? "NetworkVariable<FixedString64>" doesn't seem to work anymore.

    Thank you !
     
  6. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    118
    Having the documentation up to date and accurate should be a priority, it's been almost two months and this isn't the only page that needs correcting.

    Try using FixedString64Bytes, I've been using that without any problems.
     
  7. VincentAbert

    VincentAbert

    Joined:
    May 2, 2020
    Posts:
    110
    Thanks a lot ! One thing I missed was the need for the collections package...
     
  8. Brach_Unity

    Brach_Unity

    Unity Technologies

    Joined:
    May 19, 2021
    Posts:
    7
    We are working on it. We had a full release and are now doing some remedial work catching the final changes and pages that need updated. It will be our main focus now so we are hoping to have the pages all sorted by the end of Jan/Mid-Feb
     
unityunity