Search Unity

Missing namespace in Visual Studio 2017

Discussion in 'Addressables' started by mKosta, Jul 13, 2018.

Thread Status:
Not open for further replies.
  1. mKosta

    mKosta

    Joined:
    Mar 16, 2018
    Posts:
    5
    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?
     
    HamishDunn likes this.
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    1. double-check that you are
      using UnityEngine.AddressableAssets;
      and not UnityEditor.AddressableAssets.
    2. if you are using ADFs, add a reference to
      Unity.Addressables
      to your asmdef
     
    Zanthian and ritesh_khokhani like this.
  3. PaulBurslem

    PaulBurslem

    Unity Technologies

    Joined:
    Oct 7, 2016
    Posts:
    79
    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?
     
    ickydime, DmitryMatveev and navavl like this.
  4. mKosta

    mKosta

    Joined:
    Mar 16, 2018
    Posts:
    5
    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.
     
  5. NWalker_FGOL_Ubisoft

    NWalker_FGOL_Ubisoft

    Joined:
    Aug 10, 2015
    Posts:
    25
    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.
     
    Last edited: Jul 16, 2018
  6. giawa

    giawa

    Joined:
    Dec 6, 2015
    Posts:
    15
    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.
     
  7. NWalker_FGOL_Ubisoft

    NWalker_FGOL_Ubisoft

    Joined:
    Aug 10, 2015
    Posts:
    25
    @giawa, this fix works! Thank you!
     
  8. mKosta

    mKosta

    Joined:
    Mar 16, 2018
    Posts:
    5
    Yeah, fixed it for me aswell. Thanks!
     
  9. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    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?
     

    Attached Files:

    • win.png
      win.png
      File size:
      11 KB
      Views:
      986
    Last edited: Aug 23, 2018
  10. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    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.
     
  11. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    I'll try this, thanks a bunch @unity_bill , now way I'm quitting the great work you're adding to Unity !!! :)
     
  12. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    55
    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...

    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
     
  13. cordlc

    cordlc

    Joined:
    Jul 27, 2018
    Posts:
    11
    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.
     
    Gwom likes this.
  14. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    Thanks cordlc, I had the same problem. Will try that out.
     
  15. DAVco

    DAVco

    Joined:
    May 27, 2013
    Posts:
    7
    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)
     
  16. tommyvisic

    tommyvisic

    Joined:
    Aug 29, 2017
    Posts:
    2
    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.
     
    Celezt and nco2k like this.
  17. KB73

    KB73

    Joined:
    Feb 7, 2013
    Posts:
    234
    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

    3) 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
     
  18. JustAKgiDev

    JustAKgiDev

    Joined:
    Jul 6, 2013
    Posts:
    13
    Necropost but for anyone wondering: Right click your solution in Visual Studio and click "Rebuild Solution"...that's all.
     
Thread Status:
Not open for further replies.