Search Unity

Bug Unity Collections: 1.0.0-pre.3

Discussion in 'Editor & General Support' started by FuchsFarbe, Jul 9, 2021.

  1. FuchsFarbe

    FuchsFarbe

    Joined:
    Jun 2, 2019
    Posts:
    5
    Hello, this is my first post to any Unity forum, so apologies in advanced if this isnt the proper place.

    I saw there was an update package for the Collections (com.unity.collections) package. Since updating, the console outputs this compiler error on a script I cannot attempt to fix, since its in the unity Jobs package.

    Library\PackageCache\com.unity.jobs@0.8.0-preview.23\Unity.Jobs\IJobParallelForDefer.cs(77,85): error CS8377: The type 'U' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'
    I tried to rollback to the previous collections version, and that didn't work, although that could be because I didn't have the exact version number. There was also no update to the jobs collection that I saw. I cant proceed with my project at the moment, unless I decided to re-import everything in a new project and reinstall all the packages. My game also makes heavy use of the jobs system because I honestly enjoy fiddling with it and seeing how insane I can make a scene while still getting 300+ frames.

    If anyone has an update, quick fix, or tip for this that would be awesome! Should anyone need to see my code I am more than willing to put it somewhere to share as well, but it didn't receive compiler errors BEFORE I updated the collections, and again, on double clicking the error it only brings me to a package script I cannot edit.

    Its also worth noting this is the only thing I can find that pertains to this issue:

    https://issuetracker.unity3d.com/is...nmanaged-structs-as-containing-nullabe-fields
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
  3. FuchsFarbe

    FuchsFarbe

    Joined:
    Jun 2, 2019
    Posts:
    5

    Yes I am using Unity's job system package. I do remove unnecessary packages all the time but not this time. I cant remove the job system without crippling my code.
     
    P_Jong likes this.
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    Well the fastest solution I can see is to revert the update to those collections... this is why it is a great idea to use source control, which would give you a history of changes to your Packages/manifest.json file and let you instantly revert to a known version.

    I tried just now to track down how to even get the jobs preview package into my project and it's vanished behind yet another insanely horrible UI that (according to googling) means I need to find a git repo of the jobs package to even get the jobs package into my project. What a colossal mess!

    Maybe there's someone who can help you over on the Jobs forum on this board? Or go back to an older version of Unity, make fresh project, add the jobs, take that manifest.json and jam it into this project. Yuck.

    Good luck. What a mess!!!
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    Update: checked around some old projects and found one from 2019 using Jerbs.

    The relevant package entries are:


    "com.unity.burst": "1.0.4",
    "com.unity.collections": "0.0.9-preview.19",
    "com.unity.entities": "0.0.12-preview.32",
    "com.unity.jobs": "0.0.7-preview.12",
    "com.unity.mathematics": "1.0.1",
     
  6. FuchsFarbe

    FuchsFarbe

    Joined:
    Jun 2, 2019
    Posts:
    5

    Thank you for providing me with some packages! Usually I use source control, but 1, I'm rather bad at it, and 2, I dont have a good excuse really, I'm just bad at understanding it. Thankfully Unity provides all the relevant packages here:

    https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/install_setup.html

    I understand why they did it, and its to keep people from being mad about things like this because its easily available in the package manager. Using the wrong packages(see above), can and will break projects especially since Unity is seen as the 'entry' into game development and would leave a lot of new game-devs discouraged from trying new packages.

    With that said, I did post this to the Jobs board that I just found. I linked this post, so I hopefully can hear a reply soon. Thanks again for your help :) Also i have to say, the beta package Unity UI looks really nice and isnt 'artifacting' like my previous install.
     
    Kurt-Dekker likes this.
  7. Kirkules_

    Kirkules_

    Joined:
    Aug 5, 2014
    Posts:
    65
    I just updated and I'm getting the same error.
     
  8. P_Jong

    P_Jong

    Joined:
    Jun 14, 2017
    Posts:
    58
    I also need Jobs. This was fixed by reverting Collections 1.0.0-pre.3 back 0.17.0-preview.18 for me. I had to edit this in the manifest.json file because it was not available in the package manager. I just made sure the line with com.unity.collections had " "com.unity.collections": "0.17.0-preview.18" Be sure to backup your project and json file before doing this just to be safe. As a further note I need Jobs (0.8.0-preview.23) for Vegetation Studio Pro along with Burst (1.5.4), Mathematics (1.2.1) and Collections(0.17.0-preview.18). These seem to all work well together and are the most stable combination in my situation. Best of luck to all you Unity game devs out there!
     
  9. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    Is this going to be fixed by unity presumably in the next Jobs update?
     
  10. bennettfam93

    bennettfam93

    Joined:
    Jun 17, 2020
    Posts:
    1
    Same issue. Still waiting for a fix.
     
  11. nick_dv

    nick_dv

    Joined:
    Mar 26, 2016
    Posts:
    14
    Same issue
     
  12. darkwingfart

    darkwingfart

    Joined:
    Oct 13, 2018
    Posts:
    78
    Remove Collections. It Is built into one of the other packages now.
     
  13. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Thank you!! That was it.
     
  14. nyscersul

    nyscersul

    Joined:
    Oct 17, 2018
    Posts:
    136
    Thankyou Mr Internet Person! Solves me troubles too... :D
     
  15. Magic-Thor

    Magic-Thor

    Joined:
    Mar 31, 2020
    Posts:
    15
    Thanks, darkwingfart !!! No it's working! You saved many of my time! :) The shortest and best solution... :) THANK YOU!!! :)
     
  16. Hansel41

    Hansel41

    Joined:
    Mar 15, 2020
    Posts:
    10
    Can't remove collections because Jobs and mathematics depends on it. Any other working solution without removing anything?
     
  17. darkwingfart

    darkwingfart

    Joined:
    Oct 13, 2018
    Posts:
    78
    Mathematics is also included in entities now. You should probably remove all the ECS packages, install entities, and see if you still have dependency issues. I doubt you will, and I'm assuming you're not on the latest packages.
     
  18. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Bumping this again; I'm basically stuck on collections 0.15 or something because I use unity physics (0.6.0-preview.3, which hasn't been updated since January). This is some serious DLL hell that doesn't need to be like this.
     
    Last edited: Sep 13, 2021
    Haapavuo likes this.
  19. Kirkules_

    Kirkules_

    Joined:
    Aug 5, 2014
    Posts:
    65
    Library/PackageCache/com.unity.jobs@0.5.0-preview.14/Unity.Jobs/IJobParallelForDefer.cs(77,85): error CS8377: The type 'U' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'

    Just got this message.. again.. after reverting to an old version of collections and then updating a package it's now dependent on the latest collections pre-release:

    Collections 1.0.0-pre.5
    For me it's always the IJobParallelForDefer that throws the error because some package has a managed type for U.
     
  20. adynicu73

    adynicu73

    Joined:
    Sep 9, 2021
    Posts:
    1
    Remove Collections and install com.unity.entities
     
  21. Fabik

    Fabik

    Joined:
    Sep 22, 2019
    Posts:
    1
    Hi i have a similar problem. I'm using Unity Version 2020.3.18f1 Personal on a Mac and a get this error.

    Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/Serialization/BinarySerialization.cs(47,81): error CS8377: The type 'T' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'

    The other problem I'm having is that I can't downgrade or remove any package.
     

    Attached Files:

  22. dyhmichail

    dyhmichail

    Joined:
    Jan 16, 2016
    Posts:
    16
    Have the same problem:
    Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Entities\Serialization\BinarySerialization.cs(47,81): error CS8377: The type 'T' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'
    And cannot delete Collections, there is the screen of installed packages and their versions.
    Screen2.jpg
     
    Last edited: Oct 6, 2021
  23. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    It helped to solve my issue thank you.
     
  24. Game_Taco

    Game_Taco

    Joined:
    Jun 16, 2018
    Posts:
    3
    I was getting the same errors, and installing com.unity.rendering.hybrid didn’t work at first. My problem was that I had installed Animation Rigging before trying to install this or the entities package directly, and animation rigging was using a different version of jobs (and burst I think) than entities required. I just uninstalled everything but animation rigging, the math package, and the burst package and installed the hybrid renderer. I got a warning burst needed to be a different version, but it changed that by itself successfully. Then everything was working fine. So, if you’re having problems, and don’t want to mess with the manifest file, try uninstalling everything related to ECS first, then installing the hybrid renderer. Hopefully Unity gets all these dependency chains/conflicts worked out soon.
     
    GreedyVox likes this.
  25. GreedyVox

    GreedyVox

    Joined:
    Nov 18, 2015
    Posts:
    33
    We are in the same boat, we are using the Netcode for GameObjects, which requires Collections 1.0.0-preview.5, our project is using Entities, which we unfortunately had to temporary remove, because of the conflicts that has broken our project, hoping Unity fixes these issues soon, otherwise might have to remove Entities permanently and rewrite code :eek:
    Screenshot from 2021-12-05 12-04-36.png
     
    Last edited: Dec 5, 2021
    maxostrach and dyhmichail like this.
  26. maxostrach

    maxostrach

    Joined:
    Apr 8, 2020
    Posts:
    9
    could we get a fix for this? I am running in to this issue as well. I don't know of a workaround and doesn't seem like there is any compatibility for netcode for gameobjects and hybrid renderer 2
     
    jmcusack and dyhmichail like this.
  27. eggsamurai

    eggsamurai

    Joined:
    Oct 10, 2015
    Posts:
    115
    Use mirror.
     
  28. gslopez

    gslopez

    Joined:
    Apr 21, 2021
    Posts:
    1
    Seems like this is still an issue. This answer also worked for me
     
  29. javman1810

    javman1810

    Joined:
    Apr 25, 2020
    Posts:
    2
    How to uninstall collections?
     
  30. javman1810

    javman1810

    Joined:
    Apr 25, 2020
    Posts:
    2
    How to remove collections? I can't from package manager
     
  31. Kirkules_

    Kirkules_

    Joined:
    Aug 5, 2014
    Posts:
    65
    Packages/mainfest.json is the proper place to add/remove packages in the project (check packages-lock.json file for automatically added dependencies as well.)
     
  32. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155
    Same Problem here after downloaded Megafiers 2 to Rival tutorial sample project:

    Library/PackageCache/com.unity.jobs@0.2.10-preview.13/Unity.Jobs/IJobParallelForDefer.cs(73,85): error CS8377: The type 'U' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'

    Any idea how to solve it ?
     
  33. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155

    update: Problem Solve...Update Jobs to 0.70.0-preview.7 and the error was gone...;)
     
    czysamadeath, kong_1 and rcwongtk like this.
  34. MarcGFJ

    MarcGFJ

    Joined:
    May 16, 2019
    Posts:
    24
    I have a similar issue when trying to use 3 editors on a project with symlinked folders (the only sane technique we could think of to develop our multiplayer project).
    We symlinked only `Assets` and `Packages` (the latter contains `manifest.json`).

    The first instance works fine, the second instance works fine, but for whatever reason the third one keeps failing to compile:

    Library\PackageCache\com.unity.jobs@0.8.0-preview.23\Unity.Jobs\IJobParallelForDefer.cs(77,85): error CS8377: The type 'U' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'​

    I tried deleting the Library and restarting that third instance several times, making sure each instance is the same Unity version (2021.3.5f1), every time it fails compiling what it generates inside PackageCache. I even tried without even opening the other 2 working instances, had no luck. This particular project is broken despite being virtually a copy of the others.
    This makes no sense to me because all 3 instances use the same symlinked `manifest.json`, and they have the same project settings...

    Edit:
    Turns out all 3 instances would no longer restart because at some point the Unity Editor modified `manifest.json` behind my back...

    "com.unity.collections": "0.15.0-preview.21",​

    Became

    "com.unity.collections": "1.2.3",
    I reverted back to `0.15.0-preview.21` and that error went away [for our project].
     
    Last edited: Mar 22, 2023
  35. rcwongtk

    rcwongtk

    Joined:
    Sep 18, 2018
    Posts:
    1
    Just wanted to say you really saved my bacon here, was panicking as this error happened after installing Megafiers as well. Such a niche occurrence but you happened to post your thoughts here so I am really grateful. Thank you!
     
  36. unity_0F9462D422D352F522DF

    unity_0F9462D422D352F522DF

    Joined:
    Apr 7, 2023
    Posts:
    2
    This issue for me is yet not fixed i need any solutions
    Library\PackageCache\com.unity.jobs@0.2.9-preview.15\Unity.Jobs\IJobParallelForDefer.cs(73,85): error CS8377: The type 'U' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'