Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

ECS and Jobs Questions

Discussion in 'Entity Component System' started by sabriboughanmi01, Nov 2, 2019.

  1. sabriboughanmi01

    sabriboughanmi01

    Joined:
    Oct 11, 2019
    Posts:
    6
    Hello Everyone,
    1) is it possible to use Classes inside Jobs in any unsafe way ?
    2) is possible to link a classes to an entity ?
     
  2. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    224
    1) no, you can't pass a class reference to a job
    2) yes but you loose performance
     
    sabriboughanmi01 likes this.
  3. sabriboughanmi01

    sabriboughanmi01

    Joined:
    Oct 11, 2019
    Posts:
    6
    Thanks @SubPixelPerfect for your response!
    can you give more details about the performance waste ?
     
  4. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    224
    unity ecs is so fast because it vectorizes data
    only value types can be vectorized, the object is a reference type, so when you accessing the object via entity you getting a cache miss
     
    MNNoxMortem and sabriboughanmi01 like this.
  5. Singtaa

    Singtaa

    Joined:
    Dec 14, 2010
    Posts:
    485