Skip to content

Commit b595f37

Browse files
authored
Fixed nuget packages get lost with Unity 6 (#743)
In Unity 6 it can happen that multiple asset import worker processes get started at the same time then this will lead to undefined behavior because session data is new for each worker process, so it will execute the code in parallel multiple times.
1 parent 3443270 commit b595f37

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/NuGetForUnity/Editor/OnLoadNugetPackageRestorer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ public static class OnLoadNugetPackageRestorer
1515
/// </summary>
1616
static OnLoadNugetPackageRestorer()
1717
{
18+
#if UNITY_6000_0_OR_NEWER
19+
if (AssetDatabase.IsAssetImportWorkerProcess())
20+
{
21+
return;
22+
}
23+
#endif
24+
1825
if (SessionState.GetBool("NugetForUnity.FirstProjectOpen", false))
1926
{
2027
return;

0 commit comments

Comments
 (0)