I have tested a x64 parallel port dll in old and new Unity versions side by side on windows 10. The old one is working properly with TTL output detected in a oscilloscope, when upgraded no unity errors showed up, but No TTL output from parallel port.
I confirmed that the native plugin import settings are the same, which for both editor and player using x64 windows.
I have no clue now, because unity seems can properly load the dll, and call functions imported via Dllimport. I am wandering if Unity 6 have some internal changes that interference with the native dll. Or if someone can enlighten me about how to debug into loaded dll.
The first thing that crosses my mind is the .NET Framework version. Modern Unity uses .NET Standard by default. Perhaps you have to switch back to .NET Framework instead (if still available) for the DLL to work. This is under Player Settings, you may want to compare the compiler and code generation settings to check if they match.
Same Player Settings: try setting code stripping to None to ensure the linker won’t remove supposedly “dead” code in the DLL.
If this doesn’t help I suggest to install 2021.3 and 2022.3 and then upgrade your 2021.1 project to those versions (as copies of the project). Then check which of these still work, this may help narrow down the version it starts to fail which would make it easier to reason about possible changes between versions that are closer together in time.
Just found a bug in my code that cause the problem. Unity 6 now works just fine.
What was the bug? We’re running into the same problem with errors “Undefined symbols for architecture arm64” with some old code that imports native C++ with DllImport("__Internal") private static extern void FUNCTION.
I figure it out too. The .mm file that was being referenced from C# script on MacOS was not set to build for Standalone/Arm64 architecture.