Search Unity

Question System reads X via Y but that type was not assigned to the dependency Property

Discussion in 'Entity Component System' started by Cell-i-Zenit, Aug 6, 2021.

  1. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    Can you guys help me with this error message? I dont understand it tbh, as iam already doing this.

    TimeTravelCollectibleTransformSystem has a single Job which is defined like this:

    Code (CSharp):
    1. Dependency = Entities
    2. .WithName("TimeTravelTransform_Collectibles")
    3. .ForEach((..., in BlockData blockdata) => {
    4. //code
    5. }).Schedule(Dependency);
    6.  
     
  2. RecursiveEclipse

    RecursiveEclipse

    Joined:
    Sep 6, 2018
    Posts:
    298
    I think your issue would not be in this system, but in another one that writes to BlockData.
     
  3. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    I got this error again, slightly different:

    This time, still the same "start" system: TimeTravelCollectibleTransformSystem, but this time via a different system:
    BlockAnimationSystem:Update_LambdaJob1
     
  4. RecursiveEclipse

    RecursiveEclipse

    Joined:
    Sep 6, 2018
    Posts:
    298
    Being from a different system seems to be unusual, here was someone having a similar problem. Something is probably not right with the dependency in the other system.

    https://forum.unity.com/threads/sim...uffer-safety-and-parallel-read-write.1122301/

    BTW if you don't need complex dependencies(ie multiple jobs in a system are logically allowed run at the same time), you can omit passing Dependency to the ForEach, the jobs will automatically chain together in the order they are defined without manually using Dependency.
     
  5. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    I know that i can omit passing the Dependency to the Schedule() method, but to me it looks like it fails in the codgen, so i want to make everything as explicit as possible for the code generator :)

    I just reversed some code where some "weird" stuff happens and it looks like i cannot run this code here:

    Code (CSharp):
    1. protected override void OnStopRunning()
    2. {
    3.   Dependency = Entities.ForEach((ref BasslineAnimation basslineAnimation, in BlockData blockData) =>
    4.     {
    5.       basslineAnimation.Value = float4.zero;
    6.     })
    7.     .Schedule(Dependency);
    8. }
    Is it not possible to run jobs in OnStopRunning() etc?
     
  6. RecursiveEclipse

    RecursiveEclipse

    Joined:
    Sep 6, 2018
    Posts:
    298
    Maybe not, at least not ForEach, I had dependency issues when I was trying to add my own update methods and had to call them from OnUpdate() to get it working without calling .Complete().

    OnStopRunning() is called when there are no entities matching the system, so updating the Dependency with a ForEach there could be a logical error so it never gets run.
     
    Last edited: Aug 6, 2021