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.

Bug Entities 1.0 2D URP fix

Discussion in 'Entity Component System' started by JooleanLogic, Jan 9, 2023.

  1. JooleanLogic

    JooleanLogic

    Joined:
    Mar 1, 2018
    Posts:
    447
    This is a workaround fix to following post here (locked) and for anyone having this bug with 2d.Animation package which I also just encountered in latest version 2022.2.1f1 and Entities 1.0.0-pre.15.
    I've only briefly tested this but the changes seem pretty inconsequential so can't see it causing issues.

    com.unity.2d.animation@9.0.1/Runtime/TransformAccessJob.cs
    Code (CSharp):
    1. // Line 165
    2. log += "TransformData Count: " + m_TransformData.Count + "\n";
    3. //log += "TransformData Count: " + m_TransformData.Count() + "\n";
    com.unity.2d.animation@9.0.1/Editor/MeshUtilities.cs
    Code (CSharp):
    1. Line 32
    2. var outlineEdges = new NativeList<int2>(edges.Count, Allocator.Temp);
    3. //var outlineEdges = new NativeList<int2>(edges.Count(), Allocator.Temp);
    4.  
    5. Line 41
    6. return outlineEdges.AsArray().ToArray();
    7. //return outlineEdges.ToArray();
    Edit: Added original error for searchability.
    Library\PackageCache\com.unity.2d.animation@9.0.0-pre.3\Runtime\TransformAccessJob.cs(165,62): error CS1955: Non-invocable member 'NativeHashMap<int, TransformAccessJob.TransformData>.Count' cannot be used like a method.
     
    Last edited: Jan 19, 2023
  2. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,126
    When I change it, Unity reverts it.

    The package cache was invalidated and rebuilt because the following immutable asset(s) were unexpectedly altered:
    Packages/com.unity.2d.animation/Runtime/TransformAccessJob.cs
    Packages/com.unity.2d.animation/Editor/MeshUtilities.cs
     
  3. JooleanLogic

    JooleanLogic

    Joined:
    Mar 1, 2018
    Posts:
    447
    Yes you can't just edit the PackageCache files. They're copied in there from an original source somewhere. On Linux they're here ~/.config/unity3d/cache/packages but I don't know where they are on Windows sorry. I've always just changed the original source files, not the PackageCache ones.

    However in searching, I found this, so I think you can straight copy the com.unity.2d.animation@9.0.1 folder from YourProject/Library/PackageCache to YourProject/Packages and that seems to override/replace Unity's version.
    I'd never done that before but it appears to work in my quick testing.
     
  4. guaralism

    guaralism

    Joined:
    Feb 7, 2020
    Posts:
    8
    I did fix it in the same way, but added
    Code (CSharp):
    1. using System.Linq;
    on the top of these files instead. It seems working so far.
     
  5. NoPants_

    NoPants_

    Joined:
    Apr 23, 2014
    Posts:
    59
    It's a bit late, but in 2022.2.12, you can go to preferences / Package Manager to see where your packages are being stored. That's how I found them.
     
  6. Cnfnbcnbrf

    Cnfnbcnbrf

    Joined:
    Feb 21, 2023
    Posts:
    1
    Can confirm that updating 2D Animation package to 9.0.2 fixed the issue for me. 2022.2.12