Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Use Package Manager and Assembly Definition Error

Discussion in '2018.1 Beta' started by zhuxianzhi, Mar 6, 2018.

  1. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    122
    1.Use Package Manager to import TextMeshPro
    2.Create Assembly Definition
    3.Can not find TextMeshPro

    version:
    Unity 2018.1.0b9
    Package Manager 1.81
    TextMeshPro 1.21
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    If you are trying to use Assembly Definitions (.asmdef) for your own scripts, then you will need to manually edit the .asmdef file to add a reference to the appropriate TMP assembly as these are not visible in the Assembly Definition Inspector in the Editor.

    The TextMesh Pro assemblies are : "Unity.TextMeshPro" for the runtime assembly and "Unity.TextMeshPro.Editor" for the editor assembly.

    Code (csharp):
    1.  
    2. {
    3.     "name": "yourAssembly",
    4.     "references": ["Unity.TextMeshPro"],
    5.     "optionalUnityReferences": [],
    6.     "includePlatforms": [],
    7.     "excludePlatforms": [],
    8.     "allowUnsafeCode": false
    9. }
    10.  
     
    Last edited: Mar 6, 2018
  3. Pratap-Dafedar

    Pratap-Dafedar

    Joined:
    Aug 30, 2013
    Posts:
    22
    +1 for the solution. -1 for the workaround, because Unity cannot detect package manager's assembly definitions in the inspector and thus add manual editing.

    I have observed some time we have to kill and launch the Unity(2018.1.0b13) to get rid of all compiler errors after the above changes.
     
    Ghosthowl, JotaRata, RaoulWB and 2 others like this.
  4. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Is there a better solution planned for this situation?
     
  5. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    I really love the package manager, but I was hit by this issue as well. Are there plans to allow referencing a package assembly in our custom assemblies without having to manually edit the .asmdef file?
     
  6. manu73

    manu73

    Unity Technologies

    Joined:
    Aug 22, 2014
    Posts:
    68
    If you are trying to refer package Assembly Definitions (.asmdef) in your custom Assembly Definitions file, Object Selector will not let you select those asmdef for now :(. But you can drag a package assembly definition file in the Inspector UI of your custom asmdef file on a newly empty entry in References.

    2018-04-25_09-17-17.gif
     
  7. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    This will work nicely. Thank you!
     
  8. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,092
    How do you actually show the packages folder though?
    I only have the Assets folder.
     
    Dave-Carlile likes this.
  9. MMOARgames

    MMOARgames

    Joined:
    Feb 28, 2013
    Posts:
    24
    I think part of the issue is that the Assembly Definitions (.asmdef) don't get recompiled properly when you import a package.

    I tried this too, then close/reopened the editor and everything worked as expected after the editor recompiled my custom assembly definitions.