Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Component

pointcache edited this page Jan 17, 2017 · 2 revisions

A component in ECS is a data unit that belongs to some entity. Components should not contain logic apart from properties/converters. The task to use Components lies on System.

Component in URSA is a class that is inherited from ComponentBase and uses this template:

public class NewComponent : ComponentBase {

    public Data data;
    [Serializable]
    public class Data : SerializedData
    {

    }

    public override void OnEnable()
    {
        base.OnEnable();
    }

    public override void OnDisable()
    {
        base.OnDisable();
    }
}

This structure must be followed verbatim when creating your own components, for ease, please use EditorTemplates that allow you to quickly create new components.

We are forced to use public override void OnEnable() Due to how Unity handles "messages", these calls must be on topmost class in hierarchy.

Clone this wiki locally