Search Unity

Unity.Netcode.Components namespace not found

Discussion in 'Netcode for GameObjects' started by brainwipe, Sep 16, 2022.

  1. brainwipe

    brainwipe

    Joined:
    Aug 21, 2017
    Posts:
    78
    Visual Studio Community 2022 (up to date) with plugin (2.0.16) cannot find the reference to Unity.Netcode.Components. Unity.Netcode is fine (I have been running with that namespace fine) but not Components.

    I know the NetworkTransform is public, I have tried deleting csproj, sln, suo, .vssettings files from the project route and re-running Edit->Preferences->External Tools (set git packages to true, all else to false) and hit Regenerate Project Files. The project files are all recreated but that doesn't fix the issue.

    How do I get the Unity.Netcode.Components namespace to be available in VS2022?

    Unity: 2021.1.25f1
    NGO: 1.0.0 Pre10
    Multiplayer Tools: 1.0.0 Pre8
    Multiplayer Samples Utilities 1.3.0 Pre

    As an aside - this reminds me of the horror of DLL hell from the late 80s. Please, for the love of all that is good, get onto .NET Core msbuild because this is ridiculous.
     
  2. jesseo_unity

    jesseo_unity

    Unity Technologies

    Joined:
    Jun 26, 2018
    Posts:
    2
    Unity.Netcode.Components is a separate assembly (dll). You probably need to add an assembly reference in your assembly definition. If you haven't worked with assembly definitions before you can read about them at https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html or https://learn.unity.com/tutorial/working-with-assembly-definitions

    The tl;dr, though, is by default a new Unity project will be able to reference NetworkTransform just fine. You're getting an error which means you have created an assembly definition somewhere. You need to add an assembly reference to Unity.Netcode.Components in that assembly definition.
     
    brainwipe likes this.
  3. brainwipe

    brainwipe

    Joined:
    Aug 21, 2017
    Posts:
    78
    Thank you! This was indeed the problem. My game code was in its own assembly definition. When I added the Components reference, I could then access the namespace from my code.

    Thanks for the great support!