Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Authoring component data and entities via scriptable objects?

Discussion in 'Data Oriented Technology Stack' started by pablothedolphin, Aug 16, 2019 at 11:09 AM.

  1. pablothedolphin


    Oct 20, 2016
    I recently promoted my Scriptable Framework on the Unity3D subreddit:

    and got some feedback saying it would be good to investigate possibilities around managing entities through scriptable objects.

    In Scriptable Framework, based on ScriptableObject Architecture, there is a separation in the API for managing either reference types or value types. This was done, partially to improve workflows when using the Job System without the Entities package because Scriptable Framework allows you to emulate the whole process of keeping your data types in separate lists but still access a common "entity" by index across many of those lists.

    Would I be able to take my framework further to more directly support the entities package? Here's links to my github and docs for those of you interested:
  2. Endlord


    Jan 7, 2014
    This looks very cool!

    From what I understand, you'll lose a few benefits of ECS with SO - namely having all the data aligned nicely in a bundle, unless you turn them into components.

    You could create a generic ScriptableObjectComponent<T> interface for deriving your custom component types, where T is a blittable value type, but that would make it hard to identify what the data represents, unless you used a tagging component on the entity, or had a separate ScriptableObjectComponent for each SO asset. I'm assuming here the compiler inlines simple setter getter properties, otherwise you'd lose a lot of the performance benefits.