Search Issue Tracker

Third Party Issue

Votes

1

Found in

6000.0.40f1

6000.1.0b8

6000.2.0a5

Issue ID

UUM-98659

Regression

No

CS0234: Missing 'ptSubject' namespace error when adding Nerdbank.MessagePack package to Unity project

-

Reproduction steps:
1. Open the attached "repro_IN-94432" project
2. Open the "Assets/Scenes/SampleScene.unity" Scene
3. Observe the Console

Expected result: No errors are thrown
Actual result: Two "Library\PackageCache\com.unity.2d.animation@494a3b4e73a9\Editor\SkinningModule\OutlineGenerator\OutlineGenerator.cs(X,Y): error CS0234: The type or namespace name 'ptSubject' does not exist in the namespace 'PolyType' (are you missing an assembly reference?)" errors are thrown

Reproducible with: 6000.0.40f1, 6000.1.0b8, 6000.2.0a5
Couldn’t test with: 2022.3.59f1 - Compilation errors (“MsgPackUser.cs“ Script doesn’t work on this version)

Reproducible on: Windows 10 (22H2), Windows 11 (24H2) (user's)
Not reproducible on: No other environments tested

  1. Resolution Note:

    The 2D Animation package is not the cause of this issue. To resolve conflicts between packages, users should change how they import DLLs in third-party packages.

    Cause of compile error

    UnityEditor.U2D.Animation.ClipperLib.PolyType is defined as an Enum type in the 2D Animation package. On the other hand, the managed DLLs included in the PolyType package use the PolyType as a namespace; if the DLL's import setting is specified as Auto Reference, it will automatically reference the library code. This causes "PolyType" to conflict in two packages.

    How to fix

    To fix this problem, disable Auto Reference in the import settings of DLLs. And explicitly reference the DLL in the Assembly Definition. In the case of this project, two DLLs use the PolyType namespace: PolyType.dll and Nerdbank.MessagePack.dll. Turn off Auto Reference for these two DLLs. In addition, create an Assembly Definition to explicitly reference the DLLs, enable Override References in the Assembly Definition, and specify the two DLLs in the Assembly References. This will eliminate compilation errors and allow you to use PolyType functionality.

Comments (1)

  1. andrewarnott

    Mar 19, 2025 15:34

    This is resolved with unity's help. Updated instructions now available in our own unity docs:
    https://github.com/AArnott/Nerdbank.MessagePack/pull/320

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.