Search Unity

  1. The 2021.2 beta is now available. To find out what's new, have a look at our 2021.2 beta blog post.
    Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  3. Dismiss Notice

Creating ArcheTypes

Discussion in 'Project Tiny' started by Tomiha_be, Apr 1, 2019.

  1. Tomiha_be


    Jan 14, 2016
    I'm trying to define an ArcheType, but even the simplest ArcheType gives me the same error.

    I reduced the code to this:
    (Only trying to add 1 component to this ArcheType)

    Code (JavaScript):
    1. let dotArcheType =[game.Tag_TrailDot]);
    The console always throws the following error:
    > Entity archetype has a duplicate (or unsorted) component type -- are you attempting to add a component that already exists?
    > uncaught exception: abort("Assertion failed: types[i - 1] < types, at: C:/Users/Abdul/Documents/tiny/Runtime/modules/core/src/arch/ArchetypeManager.cpp,49,"). Build with -s ASSERTIONS=1 for more info.

    (As you can see I'm only adding one component)

    Any Ideas?
  2. Pakor


    Feb 2, 2017
    Using the following code I can get a working archetype. It seems the issue is that you can't add only one component. This makes sense as archetypes are meant to be used for spawning entities that have the same set of components.

    Code (JavaScript):
    1. if (ut.Core2D.Input.getKeyDown(ut.Core2D.KeyCode.S))
    2. {
    3.       let testArcheType =, Tag_IsAn, Tag_Example);
    4.       //returns a pointer to the archetype created.
    5.       console.log(testArcheType);
    6. }
    reallyhexln likes this.
  3. reallyhexln


    Jun 18, 2018
    I assume your problem is invalid way of passing arguments. You should pass the varargs instead of array.

    So, to create an archetype, instead of:

    Code (JavaScript):
    1. let dotArcheType =[game.Tag_TrailDot]);
    you should use:

    Code (JavaScript):
    1. let dotArcheType =;
    I have tried to create an archetype with single component, and it was created successful.