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. Dismiss Notice

Question [Entities 0.50] Type or namespace does not exist error

Discussion in 'Entity Component System' started by xVergilx, May 4, 2022.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,292
    For some reason source generators try to take invalid types / namespaces:
    Where it should be Data.Jumping.PerformJumpOnPath instead of AI.Data.PerformJumpOnPath.

    Generated code looks correct, but compilation still fails:
    Code (CSharp):
    1. void NotifyAIJumpSystem_LambdaJob_1_LambdaBody(AI.Composition.JumpingAI jumpingAI, in Data.Jumping.PerformJumpOnPath jumpData)
    Entities 0.17 were compiling just fine, so I assume this is a bug.
    Does anyone know what's causing this or a workaround?
     
    Last edited: May 4, 2022
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,292
    So refactoring from Data.Jumping.PerformJumpOnPath to Jumping.PerformJumpOnPath let it compile.
    I guess source generators don't like when namespaces have identical naming. Huh

    E.g.
    AI.Data and Data.Jumping.X doesn't work for some weird reason.
     
  3. unity_shawn

    unity_shawn

    Joined:
    May 27, 2020
    Posts:
    3
    I got the same error. I guss any class writing in my custom package or custom assembly can't be reference by the generated code. I also have not get a solution, the only I can do is avoid to use lambda job
     
  4. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,653
    Same for
    Systems
    namespace
     
    xVergilx likes this.
  5. joepl

    joepl

    Unity Technologies

    Joined:
    Jul 6, 2017
    Posts:
    85
    Hey there, both of these should be fixed in the 0.51 Entities release. If you are still seeing the issue there, can you post some code that repros the issues and I'll get to the bottom of it.
     
    w409544041 and xVergilx like this.
  6. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,653
    Well we're in progress of migrating to 0.51 right now and if we had "Systems" namespace - compiler didn't want to compile that, we've changed namespace to GameSystems and it fixed the issue. (Unitty 2021.3.4f1, Entities 0.51). But there were other errors which we fixed after, and now if we changing namespace back to Systems - no issue with compiler. Probably because of other compiler issues it showed false positive exception.
     
  7. unity_shawn

    unity_shawn

    Joined:
    May 27, 2020
    Posts:
    3
    I've already upgrad the entities package to 0.51.0-preview.32. The problem still exists
     
  8. w409544041

    w409544041

    Joined:
    Aug 3, 2017
    Posts:
    52
    me too, The problem still exists,(Unitty 2021.3.6, entities 0.51.1-preview.21).
     
  9. w409544041

    w409544041

    Joined:
    Aug 3, 2017
    Posts:
    52
    public partial class IncreaseLastHitTimerSystem : SystemBase
    {




    protected override void OnUpdate ()
    {
    float dt = GetSingleton<GameTimeDelta>().dT;
    Entities
    .ForEach( ( ref LastHitTimer timer ) => timer.Value += dt )
    .WithBurst()
    .ScheduleParallel();
    }

    }