Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Is there a tutorial/document/thread that explains how AuthoringComponents are intended to work?

Discussion in 'Entity Component System' started by alexchesser, Sep 1, 2019.

  1. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    147
    Hi there,

    I’m specifically looking at the IConvertGameObjectToEntity you get from the Create -> ECS -> Authoring Component Type template. How would one use this within a pure ECS build? What concrete examples of things would I use this for?

    Would I (for example) create a prefab "small health potion" and attach an AuthoringComponent with a serializable field for ‘heal amount’. So I could create a series of items in the editor where game designers might be able to edit parameters without requiring code?

    Sorry if that isn’t clear, i’m Maybe a little confused about the reasons this component template has been added and the optimal intended uses for it.
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,278
    Exactly!

    Not just prefabs, you can also use it for all custom data on all your scene GameObjects and then drop all those GameObjects into a subscene. Unity will convert the subscene to Entities and bake the result into a binary file so that on game load the game doesn't have to convert all those entities.
     
  3. RecursiveEclipse

    RecursiveEclipse

    Joined:
    Sep 6, 2018
    Posts:
    298