Search Unity

Is GetComponent, Instantiate, and Destroy fast now?

Discussion in 'Entity Component System' started by alexevaldez, Nov 20, 2018.

  1. alexevaldez

    alexevaldez

    Joined:
    Jun 13, 2013
    Posts:
    6
    Hi guys,

    I'm using ECS twin stick shooter hybrid example as my basis for learning ECS. I'm wondering if the example isnt fully optimized?

    Because usually when I code I pool rather than instantiate, and just deactivate them. I also notice alot of GetComponents rather than storing them. Should I code like this or should i optimize them?

    Thanks!
     
  2. You should optimize them. This demo is demonstrating the ECS part, it has its focus. So other parts just there to work with something.
     
    Antypodish likes this.
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    Yep.
    While creating and destroying entities is already lightning fast, there is plenty room further optimization.
    But as @LurkingNinjaDev said, demo shows certain concept. This allows new ECS programmers get grip on basics.
     
  4. alexevaldez

    alexevaldez

    Joined:
    Jun 13, 2013
    Posts:
    6
    Aht Thank you!