question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't import Unity.Netcode.TestHelpers.Runtime

See original GitHub issue

Description

Hi, I’m trying to use the NetcodeIntegrationTest class, which is in the Unity.Netcode.TestHelpers.Runtime namespace. When I try to import the namespace, I get an error that TestHelpers does not exist in the Unity.Netcode namespace.

I referenced the com.unity.netcode.testhelpers.runtime assembly in my .asmdef

Reproduce Steps

  1. Create an Assembly Definition Asset
  2. Add the reference com.unity.netcode.testhelpers.runtime
  3. Create a script in the same directory
  4. Try to import Unity.Netcode.TestHelpers.Runtime

Actual Outcome

The namespace cannot be imported because the reference is not present in the project references

Expected Outcome

The namespace can be imported and the reference is present in the project references

Screenshots

asmdef

Environment

  • OS: Windows 10
  • Unity Version: 2022.1.23f1
  • Netcode Version: 1.4.0 (same result on 1.1)
  • Netcode Commit: Not sure. Installed from Unity Package Manager.

Additional Context

The .cs files are visible in Library\PackageCache\com.unity.netcode.gameobjects@1.4.0\TestHelpers\Runtime, but Unity never builds a .dll and puts it in Library/ScriptAssemblies

Issue Analytics

  • State:open
  • Created 5 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
NoelStephensUnitycommented, May 11, 2023

@Maclay74 @KenjiTakahashi-Rial As a side note, I wasn’t 100% correct and there is a way to use just the package and expose testables.

Sorry for not including this option, but as an alternate way you can add a “testables” entry to your manifest file just after the dependencies section:

{
  "dependencies": {
(all of your project's package dependencies) 
},
  "testables": [
    "com.unity.netcode.gameobjects"
  ]
}

This should also work when using the NGO package (and not have to point to the release branch).

1reaction
Maclay74commented, May 10, 2023

@ShadauxCat @NoelStephensUnity thanks for the explanation and the example!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't import Unity.Netcode.TestHelpers.Runtime
Hi, I'm trying to use the NetcodeIntegrationTest class, which is in the Unity.Netcode.TestHelpers.Runtime namespace. When I try to import ...
Read more >
Namespace Unity.Netcode.TestHelpers.Runtime
Derive from this class to create your own conditional handling for your NetcodeIntegrationTest integration tests when dealing with more ...
Read more >
Troubleshooting - Unity's Package Manager
If your network can't reach the package registry server, it's probably because there is a connection problem with the network.
Read more >
COMPLETE Unity Multiplayer Tutorial (Netcode for ... - YouTube
You can do what I did and right click your Assets folder in the Project tab and click Create -> Netcode (was at...
Read more >
Class NetcodeIntegrationTest | Netcode for GameObjects
Registers the CanClientsLoad and CanClientsUnload events of the ClientSceneHandler. The default is: Unity.Netcode.TestHelpers.Runtime.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found