Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[DisableAutoCreation] throws warning on abstract and generic systems

Discussion in 'Entity Component System' started by MartijnGG, Jun 13, 2019.

  1. MartijnGG

    MartijnGG

    Joined:
    May 3, 2018
    Posts:
    74
    When I have an abstract or Generic ComponentSystem defined in my code which is tagged with [
    DisableAutoCreation], I get the following error when I start my game.


    Invalid [DisableAutoCreation] on Test.TestSystemBase (only concrete types can be instantiated)


    This seem to be caused by the default ECS World filtering the systems to add to it automatically during startup.

    However shouldn't this error check be the opposite? I've explicitly tagged it NOT to be automatically created, because it is an abstract generic system.
     
  2. TLRMatthew

    TLRMatthew

    Joined:
    Apr 10, 2019
    Posts:
    65
    It's telling you that it literally can't instantiate an abstract system, so putting [DisableAutoCreation] on it won't do anything. I suspect it's to prevent people thinking that classes inherited from the abstract system will also inherit the attribute (they won't).
     
  3. MartijnGG

    MartijnGG

    Joined:
    May 3, 2018
    Posts:
    74
    But the attribute is inheritable. If they wanted this to not be the case, it should be turned off.
     
  4. starikcetin

    starikcetin

    Joined:
    Dec 7, 2017
    Posts:
    340