Search Unity

Question Entities package errors when importing in existing project

Discussion in 'Entity Component System' started by aganm, Oct 29, 2020.

  1. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    When I try to import com.unity.entities in an existing project, unity gives me these errors:

    Library\PackageCache\com.unity.entities@0.14.0-preview.19\Unity.Entities\Serialization\ManagedObjectBinarySerialization.cs(70,33): error CS0117: 'BinarySerialization' does not contain a definition for 'ToBinary'

    Library\PackageCache\com.unity.entities@0.14.0-preview.19\Unity.Entities\Serialization\ManagedObjectBinarySerialization.cs(148,40): error CS0117: 'BinarySerialization' does not contain a definition for 'FromBinary'


    Any idea how I could fix that?
     
  2. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Which Unity version? The last one supported on 2019.4 is 0.11, any newer version requires at least 2020.1
     
  3. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    I'm using 2020.1.
     
  4. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    There's an error in entities package 0.14.

    If you open Packages\Entities\Unity.Entities\Serialization\ManagedObjectBinarySerialization.cs

    go to line 70.
    70            BinarySerialization.ToBinary(m_Stream, obj, parameters)


    There is no definition for BinarySerialization.ToBinary().

    Try opening the definition for it, your IDE won't find it.
     
  5. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Can you share you manifest? Maybe you installed the serialization package manually, if so, uninstall it and let the package manager solve the correct dependency for you.
     
  6. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    My manifest

    Code (CSharp):
    1. {
    2.   "dependencies": {
    3.     "com.unity.collab-proxy": "1.3.9",
    4.     "com.unity.entities": "0.14.0-preview.19",
    5.     "com.unity.ide.rider": "1.2.1",
    6.     "com.unity.ide.visualstudio": "2.0.2",
    7.     "com.unity.ide.vscode": "1.2.1",
    8.     "com.unity.postprocessing": "3.0.1",
    9.     "com.unity.test-framework": "1.1.16",
    10.     "com.unity.textmeshpro": "3.0.1",
    11.     "com.unity.timeline": "1.3.6",
    12.     "com.unity.ugui": "1.0.0",
    13.     "com.unity.modules.ai": "1.0.0",
    14.     "com.unity.modules.androidjni": "1.0.0",
    15.     "com.unity.modules.animation": "1.0.0",
    16.     "com.unity.modules.assetbundle": "1.0.0",
    17.     "com.unity.modules.audio": "1.0.0",
    18.     "com.unity.modules.cloth": "1.0.0",
    19.     "com.unity.modules.director": "1.0.0",
    20.     "com.unity.modules.imageconversion": "1.0.0",
    21.     "com.unity.modules.imgui": "1.0.0",
    22.     "com.unity.modules.jsonserialize": "1.0.0",
    23.     "com.unity.modules.particlesystem": "1.0.0",
    24.     "com.unity.modules.physics": "1.0.0",
    25.     "com.unity.modules.physics2d": "1.0.0",
    26.     "com.unity.modules.screencapture": "1.0.0",
    27.     "com.unity.modules.terrain": "1.0.0",
    28.     "com.unity.modules.terrainphysics": "1.0.0",
    29.     "com.unity.modules.tilemap": "1.0.0",
    30.     "com.unity.modules.ui": "1.0.0",
    31.     "com.unity.modules.uielements": "1.0.0",
    32.     "com.unity.modules.umbra": "1.0.0",
    33.     "com.unity.modules.unityanalytics": "1.0.0",
    34.     "com.unity.modules.unitywebrequest": "1.0.0",
    35.     "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    36.     "com.unity.modules.unitywebrequestaudio": "1.0.0",
    37.     "com.unity.modules.unitywebrequesttexture": "1.0.0",
    38.     "com.unity.modules.unitywebrequestwww": "1.0.0",
    39.     "com.unity.modules.vehicles": "1.0.0",
    40.     "com.unity.modules.video": "1.0.0",
    41.     "com.unity.modules.vr": "1.0.0",
    42.     "com.unity.modules.wind": "1.0.0",
    43.     "com.unity.modules.xr": "1.0.0"
    44.   }
    45. }
    46.  
    I only installed com.unity.entities and I let I let the package manager install the dependencies
    upload_2020-10-30_8-49-27.png
     
  7. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Do you have any other errors on your console? Does that happen on a fresh project? Tried to reproduce here with no luck
     
  8. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Hmm, your manifest doesn't match with your package manager, there is no Hybrid Renderer on your manifest, but it is showing up on your package manager. Are you sure you are showing the right one? For comparison, this is my Package Manager when I copy & paste your manifest (Enable Preview Packages is on and Show Dependencies is on in the Project Settings):
    upload_2020-10-30_10-41-46.png
     
    futurlab_peterh likes this.
  9. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    Yes sorry, I copied my manifest first and then I also installed the hybrid renderer.

    I have no other errors, but now I located the cause of error.

    It's an asset I am using. I don't know why but anytime I have entities package installed, and this particular asset in my project folder, I get errors in the entities package. I will try to get insight from the developer of the asset.
     
    brunocoimbra likes this.
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Have you switched to. NET 4.0?

    Are you upgrading from existing entities package to late 0.14?
    As suggested earlier, check all packages dependencies, if they are matching.
     
  11. XochiInteractive

    XochiInteractive

    Joined:
    May 21, 2018
    Posts:
    19
    Hey I'm having the exact same issue as you from an asset pack as well. Have you resolved this issue and if so, how? I'm using Entities version 0.16 and have my API Compatibility Level at .NET 4.x am I missing something else?
     
    Last edited: Nov 29, 2020
  12. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    I haven't resolved the issue. All I did was contact the authors of the asset which was causing the issue and make them aware of the problem. I am still waiting for an update from them. In the meanwhile, I am using other assets which don't cause this problem with the Entities package.
     
    XochiInteractive likes this.
  13. XochiInteractive

    XochiInteractive

    Joined:
    May 21, 2018
    Posts:
    19
    Thank you, hopefully it gets resolved. Which asset was it for you that caused the problem? I wonder if it's the same asset as one of them in my project.
     
  14. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,251
    aganm likes this.
  15. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,251
    @aganm @XochiInteractive @brunocoimbra We went through all the codes while TerraWorld and entities package are present in project and could not find collision parts as it happens occasionally and strangely!

    But a temporary workaround is to replace the 2 following lines with errors in ManagedObjectSerialization.cs script:

    Replace
    Code (CSharp):
    1. BinarySerialization.ToBinary(m_Stream, obj, parameters);
    With
    Code (CSharp):
    1. Unity.Serialization.Binary.BinarySerialization.ToBinary(m_Stream, obj, parameters);

    & Replace
    Code (CSharp):
    1. return BinarySerialization.FromBinary<object>(m_Stream, parameters);
    With
    Code (CSharp):
    1. return Unity.Serialization.Binary.BinarySerialization.FromBinary<object>(m_Stream, parameters);

    However they will keep reverting back to their initial states after project restart or deep compilation of packages.
     
  16. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,251
  17. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,251
    UPDATE:
    Good news, the conflicts between Unity Entities package and TerraWorld have been resolved by our dev team and now you can use DOTS along with TerraWorld in your projects.

    Next version comes with the fix.
     
  18. HZF

    HZF

    Joined:
    Apr 19, 2015
    Posts:
    1
    I tryed using TerraWorld today with Unity verson 2019.4.18f and have the same problem. and I'm looking forward to the new update:)
     
  19. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,251
    Sorry for the delay, next release has been delayed a bit but will be there soon with entities package and DOTS compatibility. Stay in touch with us here at Discord: https://discord.gg/9J6Jk7B
     
    XochiInteractive likes this.