Search Unity

System Configuration Data

Discussion in 'Entity Component System' started by EvansT, Feb 8, 2019.

  1. EvansT

    EvansT

    Joined:
    Jan 22, 2015
    Posts:
    22
    I'm trying to convert my existing game to use ECS with the hybrid approach. Currently I have a bunch of 'configuration data' in the form of scriptable objects. References to them are assigned directly in monobehaviours that need that data.
    Now that I'll be converting those MonoBehaviours to Systems, how can I access those scriptable objects from the systems? I don't want to make those Scriptable Objects as Singletons. The only option I can think of is to create a few new MBs that have references to the SOs and then access the MBs from the system in order to get to the Scriptable Objects. Is there a better way that I'm missing?
     
  2. Ofx360

    Ofx360

    Joined:
    Apr 30, 2013
    Posts:
    155
    I like the mb way, but you could also load them on demand/async with Resources and/or Addressables(preview package).
     
  3. EvansT

    EvansT

    Joined:
    Jan 22, 2015
    Posts:
    22
    Thanks. I'm not sure if Addressables will be the right solution for me as the configuration data will change from scene to scene. I will look into it some more.
     
  4. EvansT

    EvansT

    Joined:
    Jan 22, 2015
    Posts:
    22
    Now I have a bunch of single MBs whose only purpose it to either reference a Scriptable Object containing data or directly contain data themselves. Is this the ECS way of handling level-specific data of which there is only a single instance?