You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is common to assign RequireComponent for a self-defined component in Unity for easier initialization.
Like this:
classSubComponent:MonoBehaviour{}[RequireComponent(typeof(SubComponent),typeof(SpriteRenderer))]classCustomComponent:MonoBehaviour{}varobj=newGameObject("Test",typeof(CustomComponent));// Then obj has CustomComponent, SubComponent, SpriteRenderer together.
Is it possible to implement it in Friflo? like this:
[RequireComponent(typeof(Position))]structAnimData:IComponent{publicintframe_idx;publicSprite[]ref_frames;}vare=store.CreateEntity(newAnimData());// Then e has both AnimData and Position components.
To my knowledge, it is possible to expand Generic<AnimData>.ComponentTypes through the attribute,
The text was updated successfully, but these errors were encountered:
Thought about this.
It is possible but doing this has a performance impact on all AddComponent<> and CreatEntity() operations. Whether with or without this attribute.
Additionally understanding of code is more complicated because components may be added implicit.
You now have to check component type attributes when adding them.
Otherwise you will wonder why a component was added without doing this explicit.
It is common to assign
RequireComponent
for a self-defined component in Unity for easier initialization.Like this:
Is it possible to implement it in Friflo? like this:
To my knowledge, it is possible to expand
Generic<AnimData>.ComponentTypes
through the attribute,The text was updated successfully, but these errors were encountered: