Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug Exception during SubScene import: T must already be filtered by ComponentSystemBase or ISystem

Discussion in '2022.2 Beta' started by andrew-lukasik, Nov 12, 2022.

  1. andrew-lukasik

    andrew-lukasik

    Joined:
    Jan 31, 2013
    Posts:
    249
    Unity 2022.2.0b14 / com.unity.entities@1.0.0-exp.12
    What this message wants me to do, exactly?

    Here is the source code that throws this exception:
    Code (CSharp):
    1. // Only derivatives of ComponentSystemBase and structs implementing ISystem are systems
    2. if (!type.IsSubclassOf(typeof(ComponentSystemBase)) && !typeof(ISystem).IsAssignableFrom(type))
    3.     throw new System.ArgumentException($"{type} must already be filtered by ComponentSystemBase or ISystem");
    What is baffling here is that this TYPE_NAME in my case are seemingly random types like
    EHex
    enum or
    MyComponentAuthoring+<>c__DisplayClass11_0
    codegen piece.
     
    Last edited: Nov 14, 2022
    Tony_Max likes this.
  2. lgarczyn

    lgarczyn

    Joined:
    Nov 23, 2014
    Posts:
    68
    Same issue, in my case the component has nothing to do with ECS. Errors only pops up when unloading the subscene from the editor view though.
     
    Tony_Max likes this.
  3. Anthiese

    Anthiese

    Joined:
    Oct 13, 2013
    Posts:
    73
    I've seen this happen a number of times after I make some class hierarchy changes / additions in user code, mostly when adding / removing complete C# files from within an IDE, then coming back to Unity and triggering baking through Play Mode or just opening the relevant scene. I don't know of a surefire repro for this, though. To my memory, nothing was amiss just changing method implementations or otherwise changing things within types. I generally seem to be able to get around this by adding / removing / refactoring things while Unity is closed. When the problems do crop up, you can either reimport everything / delete Library/ (not great, of course) or try clearing Entities caches (in this case, also annoyingly, if it's still bugged after reloading the Editor, you go and delete the generated cache version info in Assets/).
     
    Tony_Max likes this.
  4. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    353
    Seems like reloading works for me. As mentioned before triggers when class hierarchy changes. Unity 2022.2.0b16 / entities 1.0.0-exp.12
     
  5. Jonas_DM_

    Jonas_DM_

    Joined:
    Feb 28, 2019
    Posts:
    22
    I also encounter this regularly, especially when renaming classes/structs or when moving classes/structs to a new namespace or assembly. The larger the change the more likely it is to happen.

    I have to delete the Library folder, the GlobalEntitiesDependencies folder & SceneDependencyCache folder.
    Just clearing the Entity Cache does not fix it.

    Like you said, the errors don't make any sense.
    It could be a bug with the TypeManager and the AssetImporter.