Can I use assembly definition file?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
elda27
Posts: 8
Joined: Fri Nov 17, 2023 11:11 am

Can I use assembly definition file?

Post by elda27 »

I made an assembly definition to test my code.
But I ran into an error with the using PixelCrushers.DialogueSystem part, and I can't seem to find the right assembly definition for it.
Any ideas on how to fix this?

Code: Select all

{
    "name": "PackageName",
    "rootNamespace": "",
    "references": [
        "Unity.TextMeshPro",
        "Unity.VisualScripting.Core",
        "Zenject"
    ],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false,
    "overrideReferences": true,
    "precompiledReferences": [
    ],
    "autoReferenced": true,
    "defineConstraints": [],
    "versionDefines": [],
    "noEngineReferences": false
}
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can I use assembly definition file?

Post by Tony Li »

Hi,

Import Plugins / Pixel Crushers / Dialogue System / Scripts / DialogueSystemAssemblyDefinitions.unitypackage.

Some devs don't use asmdefs, so they're provided as a separate package.
elda27
Posts: 8
Joined: Fri Nov 17, 2023 11:11 am

Re: Can I use assembly definition file?

Post by elda27 »

Thanks!
I've obtained the assembly definition, but I've run into a new error.
The following is one of the specific error messages:

Assets\Plugins\Pixel Crushers\Common\Scripts\UI\SetLocalizedFont.cs(27,17): error CS0246: The type or namespace name 'TMPro' could not be found

I've examined its script and noticed that it lacks a using TMPro directive.
I understand that this program works correctly when used without an assembly definition.
It seems that I might need to make additional settings in the assembly definition in this case.
Here's the content of my assembly definition file.

Code: Select all

{
    "name": "Amber",
    "rootNamespace": "",
    "references": [
        "Unity.TextMeshPro",
        "Unity.VisualScripting.Core",
        "Zenject",
        "DialogueSystem"
    ],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false,
    "overrideReferences": true,
    "precompiledReferences": [
        "DOTween.dll"
    ],
    "autoReferenced": true,
    "defineConstraints": [],
    "versionDefines": [],
    "noEngineReferences": false
}
elda27
Posts: 8
Joined: Fri Nov 17, 2023 11:11 am

Re: Can I use assembly definition file?

Post by elda27 »

I have found a solution.

https://www.pixelcrushers.com/phpbb/vie ... php?t=6379

I added Unity.TextMeshPro to both PixelCrushes and DialogueSystem.
Thank you very much.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can I use assembly definition file?

Post by Tony Li »

Hi,

Yes, that's the solution. Not every project uses TextMesh Pro, so the TextMesh Pro asmdef isn't added to the Dialogue System asmdefs. If you've imported the Dialogue System asmdefs and you're using any packages such as TextMesh Pro or Cinemachine and have turned on support for them in the Welcome Window, you should add references to their asmdefs like you did.
Post Reply