Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Build Fails

Discussion in 'Addressables' started by SentientSkull, Oct 18, 2020.

  1. SentientSkull

    SentientSkull

    Joined:
    Apr 26, 2013
    Posts:
    75
    I'm trying to learn how to use Addressables and following the instructions in Unity's manual. When I try to build (Build, New Build, Default Build Script), I get a lot of errors for various scripts in the project saying it can't find 'type or namespace' for things that are definitely there, followed by

    Failed to compile player scripts
    UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)

    and

    SBP ErrorError
    UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)

    If I clear the console, the game will run fine with no errors.

    For this test all I did was create a prefab from a cube and mark it as addressable.

    Any idea what I'm doing wrong?

    Unity 2020.1.9
     
  2. m4gni2de

    m4gni2de

    Joined:
    May 30, 2018
    Posts:
    13
    Can you post some screenshots of the errors please?
     
  3. AriyaSD

    AriyaSD

    Joined:
    Nov 2, 2019
    Posts:
    24
    Don't use anything in the UnityEditor namespace in scripts that are gonna end up in your build. They're only supposed to be available in the editor.
     
  4. SentientSkull

    SentientSkull

    Joined:
    Apr 26, 2013
    Posts:
    75
    I was able to get it to build after I realized all the errors were from a package I installed (SerializableDictionary) that was calling things from the UnityEditor namespace without using the '#if UNITY_EDITOR' define.
     
  5. DeathPro

    DeathPro

    Joined:
    Jul 28, 2018
    Posts:
    87
    If you have .asmdef files, make sure to only mark the Editor field for Editor Scripts which is generally in Editor Folder.

    I have this issue then I edit .asmdef files accordingly Editor sides. It worked. You should not have any Editor Scripts on Runtime.

    I had these errors!
    DOTween_AddressablesBuildError.PNG


    If you have DOTween package in your project. You can check the "Create ASMDEF..." to create .asmdef files properly for DOTween.

    DOTweenPanelOpen.png

    DOTweenCreateASMDEF.PNG

    DOTweenEditorASMDEF.PNG