Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Operator '+' cannot be applied to operands of type 'Chunk.<Buffer>e__FixedBuffer' and 'int'

Discussion in 'Entity Component System' started by MNNoxMortem, Jun 9, 2020.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    Just updated the packages and ran into a incompatiblity
    Code (CSharp):
    1. [CompilerError] Operator '+' cannot be applied to operands of type 'Chunk.<Buffer>e__FixedBuffer' and 'int'
    2. Compiler Error at Library\PackageCache\com.unity.dots.editor@0.7.0-preview.1\Editor\EntityHierachy\DataDiffers\ComponentDataDiffer.cs:246 column 37
    3. 244:       return;
    4. -->246:   var entityDataPtr = chunk->Buffer + archetype->Offsets[0];
    5. 247:   var componentDataPtr = chunk->Buffer + archetype->Offsets[indexInTypeArray];
    6.  
    When updating DOTS Editor to 0.7.0-preview.1

    Downgrading to 0.6.0-preview solves the problem.
     
  2. Antoine_B

    Antoine_B

    Unity Technologies

    Joined:
    Jun 26, 2018
    Posts:
    10
    Can you make sure you're using the .NET Standard 2.0 Api Compatibility Level ? Any project using entities package should target this profile instead of .NET 4.x.

    You can find in Edit > Project Settings > Player > Other Settings > Api Compatibility Level.
     
    tertle likes this.
  3. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    That is incompatible with packages I am using. From the top of my head some image library using a System.Windows.Forms.dll and a file browser package, but I would need to check.

    Edit: Checked:
    • https://github.com/burningmime/arrayio requires DynamicMethod and ILGenerator. Need to do some benchmarks to see how the Dots based serialization performs compared to burningmimeio/arrayio to see if this dependency could be removed.
    • https://github.com/gkngkc/UnityStandaloneFileBrowser requires Ooki Dialogs which requires .NET Framework 4.5+. Removing the dependency to this would be annoying. I simply don't want to implement native file browser access, that is something I want out of the box. The project I am working on simply does not justify either implementing it on my own as long as I really do not have to.
     
    Last edited: Jun 10, 2020
  4. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    @Antoine_B You mean any package using fixed struct fields should use .Net Standard 2.0 Api, as this happens too when not using DOTS.
    This seems to be related to some incremental build stuff and restarting Unity fixes this for a while even with .Net 4.x.

    I would consider this a bug that needs fixing.