2022 LTS, 1.6 NGO. Float Network variable - Specified cast is not valid

Does unity even check what it releases? This issue was known for quite some time, i found thread about it some time ago, and it is still not fixed. How can you take ngo seriously when on release of 1.6 it does not support floats. Wtf.

Could you provide the script that is causing this issue?
Also, have you looked over the NetworkVariable documentation?

No script is needed. Just declare public NetworkVariable float, double or decimal and select an object that has the script. The editor will not draw it in the inspector and throw an error.
int, for example, will work as expected.

So, you read over the requirements to use NetworkVariables?

If I understand you correctly, you are saying that you want to be able to declare the NetworkVariable as public and edit it within the inspector view? Without seeing your script, the errors it is throwing, or the version of NGO you are using I can only provide you with an example of usage.

Create a component (script file) using the below script:

using Unity.Netcode;

public class MyNetworkVariable : NetworkBehaviour
{
    public NetworkVariable<int> MyIntValue = new NetworkVariable<int>();
    public NetworkVariable<float> MyFloatValue = new NetworkVariable<float>();
}

Create a blank prefab and add a NetworkObject to it.
Drag and drop the MyNetworkVariable script onto the prefab or add the component, MyNetworkVariable, by name to your newly created prefab with NetworkObject component.
Open the prefab or select the prefab and you should see something similar to this:


It shouldn’t throw any errors or the like when viewing the prefab in the inspector view and you should actually see “NetworkVariable” next to each property.

If you are getting an error using the provided script please do post it here along with the version of NGO you are using so that I can help you with the issue you are experiencing.
[/quote]

Yes, i have read it.
And yes, your script is throwing errors.
Unity version - 2022.3.12f1. Netcode For GameObjects - 1.6.0. 1.6.0 is the latest available one.
9525943--1344190--bug.png

Ok,
So the most recent version of NGO (v1.7.1) I believe has some fixes that could address that issue.
If you don’t want to update your editor to 2022.3.15f1 (which once updated you would see the option to upgrade NGO), then there are two ways to update to the most recent version manually:

Packages/Manifest.json

  • Open your manifest.json file and find the com.unity.netcode.gameobjects entry
  • Update the version to 1.7.1 and save the file.
  • The editor should pull down that version of the NGO package.

Package Manager

  • Open the package manager and select add package by name
  • For the name enter: com.unity.netcode.gameobjects
  • For the version enter: 1.7.1
  • The editor should pull down that version of the NGO package.

Let me know if this resolves your issue?
As a side note, you can also visit the Github repository to see what the most current version is in the event you want to update to that manually in the future.