Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kleber-swf · Jun 29, 2018 at 08:00 PM · packagesassembly

Assembly Definition + Packages = ?

I have a pretty large project and I'm trying to use the Assembly Definition files to make compilation faster.

With the new Unity package management, I'm using some extensions as packages as recommended. One of them is TextMeshPro.

But now, TMPro can't be found anymore.

Is there any way to make it work?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kleber-swf · Jun 29, 2018 at 09:36 PM 0
Share

I found an issue on Unity Issue Tracker that says that it's fixed, but it's really not (or I'm doing something wrong here). https://issuetracker.unity3d.com/issues/cant-add-references-to-package-manager-asmdef-files-from-the-editor

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Lightzer · Jul 12, 2018 at 08:53 PM

I've found the answer here: https://forum.unity.com/threads/use-package-manager-and-assembly-definition-error.520519/

I've tested it, and it works for me. Not happy with the answer, but I guess it works :\

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kleber-swf · Jul 13, 2018 at 07:03 PM 0
Share

That made it. Well, I updated to version 2018.2.0 also. But the workaround did the trick. Thanks!

avatar image
2

Answer by OleJuergensen · Jul 03, 2018 at 01:38 PM

An assembly definition file will cause all script on that folder level and below in the hierarchy to be compiled into a separate assembly. Think of it like a library. All your scripts that are not part of that assembly need an explicit assembly reference to that. I think, the editor already gives you an error messages that asks you, if you forgot an assembly reference. To create such a reference, all your scripts must be in an assembly with an assembly definition file, so that you can actually define references in the first place. Create an assembly definition file for all your scripts (e.g., directly in the assets folder, or in your scripts folder). That will encompass all scripts until a different assembly definition is found in the hierarchy below. Now, if you select your main assembly definition file, you can add references to other assemblies in the editor.

Some tripping stones:

  • You cannot have cyclic reference. Scripts that depend on each other must be in the same assembly.

  • References are transitive. That means if assembly A references assembly B, which in turn references assembly C, then you can use scripts of assembly C in assembly A.

  • Editor scripts must be in a separate assembly that is marked as a test assembly (there is a checkbox in the editor for that). The same goes for tests (duh). This is because you don't want these scripts to be compiled in your final build. These test assemblies will need references to the assemblies of the respective runtime scripts, of course.

  • When there are editor scripts in different editor folders that reference each other, you are forced to restructure these folders. I find the most viable solution to write a utility that will rearrange scripts and folders accordingly.

  • When you have many external packages, many editor folders and a bunch of tests, you can end up with dozens of assemblies quickly. Here, I also suggest to restructure your folder structure.

    Personally, I think the concept of assembly definition files really needs improvement.

    Some references: https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html https://answers.unity.com/questions/1446378/assembly-definition-in-editor-folder.html https://forum.unity.com/threads/example-project-assembly-definition-files.482313/page-4#post-3296568

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kleber-swf · Jul 04, 2018 at 08:01 PM 0
Share

Hi there,

Well, I know how Assemblies work and that folder restructure you mention, I did it :). The problem here is that Text$$anonymous$$eshPro now can't be used since it's not an extension with a folder inside the project anymore, it's now a Package (it's really confusing though... extensions, plugins, packages). The same will occur to all packages according to this issue (note that someone there is really impatient hahah)

It doesn't answer my question but it's a very good amount of information. Thanks!

avatar image OleJuergensen kleber-swf · Jul 05, 2018 at 02:35 PM 1
Share

Oh sorry, my bad - should have read your question properly. This just seems to confirm my conception that assembly definition files just aren't production ready just yet. I wonder if it actually is possible to add the reference manually, like suggested in the issue you mentioned. But since you tried and it didn't work, we would need a response from OP or Unity.

avatar image
0

Answer by IndividualGamesUnity · Apr 02, 2021 at 01:31 PM

Problem: TMPro namespace is missing, when using TMPro;

Quick Solution: Click on your .asmdef file then in Assembly Definition References tab click on "+" and "add" the Unity.TextMeshPro from the prompt menu.

Explanation: Asmdefs and asmrefs are like chapters of a book. All the chapters need to be under the book so you can read it. You have to add the asmdef of TextMeshPro from the packages like this so your own asmdef will "link" to that codebase.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

88 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Misconfiguration of cached packages in Unity 0 Answers

Unity Engine script assemblies not accessible in my package 1 Answer

namespace support in unity 1 Answer

C# dll "MissingMethodException" - Before first recompile 1 Answer

Unable to load assembly without recreating project 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges