Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Authoring component data and entities via scriptable objects?

Discussion in 'Data Oriented Technology Stack' started by JakHussain, Aug 16, 2019.

  1. JakHussain

    JakHussain

    Joined:
    Oct 20, 2016
    Posts:
    300
    I recently promoted my Scriptable Framework on the Unity3D subreddit: https://www.reddit.com/r/Unity3D/comments/cqv2a6/scriptable_framework_now_available_via_the/

    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:

    https://github.com/pablothedolphin/Scriptable-Framework

    https://pablothedolphin.github.io/Scriptable-Framework/
     
  2. Endlord

    Endlord

    Joined:
    Jan 7, 2014
    Posts:
    11
    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.
     
unityunity