Search Unity

Question Multiple custom ICustomBootstrap specified

Discussion in 'Entity Component System' started by Phenotype, Nov 18, 2022.

  1. Phenotype

    Phenotype

    Joined:
    Oct 26, 2010
    Posts:
    53
    Trying to implement my own ICustomBootstrap but receiving the above error. The error arises in:

    Unity.Entities.DefaultWorldInitialization

    static ICustomBootstrap CreateBootStrap()

    Line 376:

    Code (CSharp):
    1. else if (!bootType.IsAssignableFrom(selectedType))
    2.                     Debug.LogError("Multiple custom ICustomBootstrap specified, ignoring " + bootType);
    The conflict is with Netcode's ICustomBootstrap implementation.

    Obviously there is no point in offering the ICustomBootstrap interface if there can only be one and unity is going to use it. Is there is another way I can add to the bootstrap process without implementing this interface?
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    You have to subclass ClientServerBootstrap. The loader will prefer the subclass over the base class.
     
    Phenotype likes this.
  3. Phenotype

    Phenotype

    Joined:
    Oct 26, 2010
    Posts:
    53
    That works but seems a bit of a hack. Now my bootstrapper has a dependency on netcode. Hopefully this will be changed. Thanks