Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

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:
    50
    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:
    50
    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!
     
unityunity