Missing namespace in Visual Studio 2017

Hey, I am trying to get my hands on the Addressables with Uinity 2018.02.0f2. I edited the package manifest and got the AddressableWindow working in my project. But any script that tries to access the namespace UnityEngine.AddressableAssets does not compile because the namspace can’t be found.
ErrorMessage:

What do I have to do to make the compiler aware of the new namespaces?

1 Like
  • double-check that you are using UnityEngine.AddressableAssets; and not Unity**Editor**.AddressableAssets.
  • if you are using ADFs, add a reference to Unity.Addressables to your asmdef
2 Likes

It might also help to remove the .vs folder and all VS files from your Unity project folder and let the editor regenerate them. Does the editor also complain about the namespace or is it just in VS?

3 Likes

Yes, I am using UnityEngine.AddressableAssets;
Since I am not exactly sure what ADFs are, I believe, I am not using them.
Deleting the .vs folder and vs files helped with the Error in the editor. Now only VS does not know the namespace but scripts run just fine in the editor.

I have the same issue, and I am using .asmdefs, and I have added Unity.Addressables. I’m also using 2018.2.0f2.

When I only add "com.unity.addressables": "0.1.2-preview" to the manifest :

  • Unity compiles but the csproject cannot find any of the .cs files. It is looking for them in the PROJECT package directory but they only exist in the %appdata% CACHE.
  • Thus, no intellisense for Addressables.
  • If I write correct code, it WILL compile.

When I merge the %appdata% CACHE directory with the PROJECT package directory (a.k.a. “embed” the package):

  • The .csproj correctly finds the .cs files BUT cannot find IAsyncOperation<>.
  • Thus, some intellisense.
  • If I write correct code, it WILL NOT compile. EDIT: Adding Unity.ResourceManager to the asmdef (after I suddenly started getting an error telling me to do so), now the code WILL COMPILE.

I had the same issue. Make sure Visual Studio (and the Visual Studio Tools for Unity (which is installed using the Visual Studio installer)) are fully up to date. I’m running Visual Studio 2017 15.7.5 and Visual Studio Tools for Unity 3.7.0.1. Just running ‘Update’ from the Visual Studio Installer should get you there. Hopefully that works for your issue as well.

3 Likes

** @giawa , this fix works! Thank you!**

Yeah, fixed it for me aswell. Thanks!

Hi! I tried the above to no avail. I am failing to download the assets from remove server for player or in editor mode; I thought the issue maybe due to caching as per this guide https://qiita.com/k7a/items/b4fd298bcb64dc968ad1#サーバーへのassetbundleの配置

The Build tool is disabled at the top of the Addressables Window, so I tried to add the following code which requires UnityEditor.Addressables but the error comes up and can’t build. I also tried adding UnityEditor.AddressableAssets namespace to this script but it still fails on the same grounds. Restarting the editor does not resolve the issue.

How access Packages/Addressables System/Editor/Build BuildScript then? Cheers, Sergio

Unity 2018.2.5f1 and also tried 2018.2.3 and 2018.2.4; Addressables packet 0.2.2

public static class AddressableAssetsUtil2
{
#if UNITY_EDITOR
[MenuItem(“Addressable / Build”)]
#endif
public static void DoBuild()
{
// BuildTarget be set Yoshinani
BuildScript.PrepareRuntimeData(true, false, true, true, false, BuildTargetGroup.Standalone, UnityEditor.BuildTarget.StandaloneWindows64);
}
}

The type or namespace name AddressableAssets' does not exist in the namespace UnityEditor’. Are you missing an assembly reference?

The BuildScript code is in the Editor assembly of our package. So you should have your entire code file above inside an Editor/ folder. Or you need to wrap the full code in your #if UNITY_EDITOR.

I’ll try this, thanks a bunch @unity_bill , now way I’m quitting the great work you’re adding to Unity !!! :slight_smile:

Addressing the original problem where using UnityEngine.AddressableAssets; is not resolving, despite the reference to Unity.Addressables.dll. That’s definitely an assembly dependency resolution problem, but it’s not limited to the primary assembly you are trying to reference. It can happen if dependent assemblies are not made available, and VS/Intellisense won’t necessarily tell you why. If you run ILDASM or Reflector on that assembly, you will see it’s dependencies…

3683707--302797--upload_2018-9-15_23-59-20.png

You can also see them in the package manifest…

C:\Users[%USERNAME%]\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.addressables@0.3.5-preview>notepad package.json

“dependencies”: {
“com.unity.resourcemanager”: “2.3.0-preview”,
“com.unity.scriptablebuildpipeline”: “1.0.1-preview”

Those things are referenced in my project packages\manifest.json

“com.unity.resourcemanager”: “2.3.0-preview”,
“com.unity.scriptablebuildpipeline”: “1.0.1-preview”,

However here’s a weird one… They were not showing up in the Package Manager UI and I could not add them as references to my .asmdef’s. I shutdown Unity and VS, removed the Visual Studio intermediates and ScriptAssemblies, then restarted. No luck. So I went and made a trivial text change to the package.json for the ResourceManager package, making the file writable, guessing that y’all are doing property FileIOCompletion notifications on the cache tree. Sure enough, PackageManager saw the change, but still didn’t show the packages. Closed the PackageManager window and re-opened it, and they were there, and I could add them to my .asmdef’s. So, feels like something wonky happening with PackageManager not fully refreshing its view on the cache? Not sure. I’m good to go and looking forward to using AssetReferences.

  • thanks

I had similar problems with missing assemblies / dependencies, on Unity 2018.2.8f1, with Addressables 0.3.5.

I was able to add Unity.Addressables to my asmdef, but I kept getting errors about missing definitions from Unity.ResourcesManager. However, there was no ResourcesManager asmdef I could add as a dependency, so I tried what others here have done, but nothing worked.

In the end, I just added
“com.unity.resourcemanager”: “2.3.0-preview”
to my [Project]\Packages\manifest.json, and everything worked out. I can now see it in PackageManager, and add it as a reference in my asmdef files.

Just sharing my experience in case it helps anyone.

1 Like

Thanks cordlc, I had the same problem. Will try that out.

Just to chime in - I found this thread because I was having the same problem:
Unity 2018.3.1f1
AddressableAssets 0.5.3-Preview installed via the package manager

Updating Visual Studio solved the problem for me (In Visual Studio: Tools > Get Tools and Features)

Hey it’s 2020 and I ran into the same/similar issue around Addressables not working re: intellisense. I’m using VS Code though. What solved the issue for me was updating to the latest version of the “Visual Studio Code Editor” Unity package (1.2.0 at time of writing this) and then deleting my .csproj files and letting Unity rebuild them.

2 Likes

We are having a similar issue but using Rider and not VS Code.
All we’re trying to do is create another version of BuildFastMode but seems to be more problematic than it should be.
Our code is under an Editor folder.

What is the proper way of overriding a class from the addressables package i.e. make a new version of BuildFastMode?

We have tried

  1. Create a new package with dependencies on addressables but this leads to the above errror ( asmdef issues )
  2. Tried to create a file in Editor in the main project and clone the code but we see issues like

‘ProjectConfigData’ is inaccessible due to its protection level

error CS1061: ‘AddressablesDataBuilderInput’ does not contain a definition for ‘PathFormat’ and no accessible extension method

etc etc

  1. We have tried to clone the addressables package completely and remove it from Packages and just put it in the main project with lots of issues + lost dependencies etc

We are on 2019.2.21 .

thnx

Necropost but for anyone wondering: Right click your solution in Visual Studio and click “Rebuild Solution”…that’s all.