Add Unity mathematics support#1312
Add Unity mathematics support#1312Hertzole wants to merge 11 commits intoMessagePack-CSharp:masterfrom
Conversation
|
How about separating it into a separate asmdef? |
|
I've made a new commit with a separate assembly definition. But there are some issues I can see with this approach. It will require users to add a new Unity mathematics resolver to their resolver collection manually since the StandardResolver can't access it. The new assembly definition needs access to the MessagePack assembly thus blocking the MessagePack assembly from referencing the Mathematics assembly definition. |
|
Hi is this issue still open to contribute in? |
|
@Hertzole If the CI error can be resolved, I can merge it (what is the cause of this error......?). @alli1999 |
|
@neuecc |
|
@AArnott |
|
Oh boy. It's been so long since I set that up. I wonder how to update it.... I'll see what I can do. |
|
@neuecc It looks like 2019.4 is under LTS but newer versions also are. Should we just use the newest LTS version, or do you want 2019.4 specifically? |
|
@neuecc I have installed 2019.4 (on a new VM), but the build is failing due apparently to missing libraries. Is this because the newer Unity version has breaking changes, or because I haven't configured the VM properly?
|
|
It looks like the build break is a known breaking change in Unity, but I don't know how to translate their advice into a code change in the repo. |
|
It seems like it's just missing the UI assemblies. Would it be possible to just add the UnityEngine.UI assembly reference to the RuntimeUnitTestToolkit assembly definition? |
|
@AArnott Yeah, that's what I had in mind. Super weird that that didn't fix it... Unfortunately, I can't test anything locally either because I couldn't get the tests to even compile when opened up in Unity. It was like nothing in MessagePack existed for them. |
|
If you look at our |
|
After an unacceptably long time, I finally got around to check this out again and I got the tests to run locally without any issues. |
|
That sounds great. Yes please, @Hertzole. |
|
I've pushed the new changes to my branch here. I hope it can help! |
|
Any update on this? |
|
/azp run |
|
@AArnott This is an extremely strange issue. I've pushed a new change and I hope that can improve the situation. |
|
Failed again. Are you testing locally with Unity 2020.3.17f1? |
|
I realized now it wasn't including the Unity packages json, which UnityEngine.UI is a part of. If it runs now and gets all the packages, hopefully, it should work! |
|
Anything else we might need? Perhaps an untracked file that's on your machine but not in git? It's still failing. |
|
A wild guess but maybe it requires some project settings as well. |
|
I see that it failed again. Are you sure your Unity installation contains the UnityEngine.UIModule? I don't know much about Linux but on the windows installation it should be in Editor/Data/Managed/UnityEngine/UnityEngine.UIModule |
|
Yes, this file exists:
|
|
The interesting thing about that file is it even shows up in the log as a parameter to the compiler:
|
|
That dll doesn't define the types that are missing in the compile errors anyway. |
|
I've added a new commit that removed the noUpm argument which stops Unity from getting the packages. |
|
It's taking a lot longer now. That's a good sign. Assuming it works, are there changes you've tried that can/should be reverted at this point to cleanup? Don't worry about the failure on the mac agent. I already have a fix for that in #1345 and I plan to merge these two PRs together somehow. |
|
I don't think there's anything really that needs to be cleaned up. All of the stuff would be created by Unity anyways. |
|
This seems to be taking too long. In prior successful unity builds, this unity package step took under a minute. But this PR is running at 16 minutes and counting. Any idea why? |
|
Yeah, it seems a bit suspiciously long. Does the machine have an internet connection? Just to be sure Unity can actually fetch the packages. |
|
No idea why -noUpm was there. I didn't even know what it did. I probably copied it from some script that @neuecc was using earlier. |
|
And ya, the build agent certainly has an Internet connection. If you think it's downloading gobs of packages that could be taking a long time, I'll just let it run a while longer (I restarted it). Maybe the first successful build takes longer than subsequent ones? That would explain why I see so little CPU on the agent while it's seemingly hung. |
|
Well, something is very broken it seems. It's been ticking for an hour now, and CPU and network usage is almost zero. Unity still bubbles "up" to 2% CPU periodically, which is quite bizarre. |
|
After the 1h timeout, this was the log: Any ideas? Does the last line suggest a cause for a hang? |
|
When it works for you, are you actually running the build.sh (or build.bat) script? |
|
I unfortunately don't have any idea what could be causing the hang. |
|
This pull request is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. |


This commit adds support for Unity's new mathematics they introduced a while back.
Some changes had to be done to the assembly definition that would raise the minimum Unity version to 2019.2 (which is outside the LTS range anyways) because of the version defines. The mathematics will only be enabled if the package is installed.
All the formatters are inside a USE_UNITY_MATHEMATICS define.