Search Unity

Why [DisableAutoCreation] is not working on a base class?

Discussion in 'Entity Component System' started by Quit, Apr 25, 2020.

  1. Quit

    Quit

    Joined:
    Mar 5, 2013
    Posts:
    63
    Hello,

    I want to create my systems manually, but adding [DisableAutoCreation] attribute on every class I want to manually initialize is a bit of a pain, because it's mostly all of them. Hence I created a base class "BaseManualSystem", which contains this attribute, and systems which should be not created automatically, I would just inherit from this base class.

    Is there any reason why I can't use this attribute on a base class? I get this warning, and my class is initialited anyway: {Invalid [DisableAutoCreation] on BaseManualSystem (only concrete types can be instantiated)}.

    Thanks in advance.
     
  2. Quit

    Quit

    Joined:
    Mar 5, 2013
    Posts:
    63
    ICustomBootstrap.cs has been changed recently, which means if it executes, Unity doesn't put it's default systems in. I wanted to predefine a filter that Unity wouldn't initialize my systems automatically, but now I cannot, unless I put [DisableAutoCreation] flag on every system. That's every single system in my game.

    I'd like Unity's default loop with my systems initialized whenever I want them to.

    If the circled value was "true", it would allow inheritance @Unity. Of course it would still print out that Debug.LogWarning(). Should just skip it silently, I think.
    Annotation 2020-04-26 164108.png

    Help please?
     
    Last edited: Apr 26, 2020