[SOLVED] Entity System

Hello there!

At the moment, I’m trying to implement entity component system and getting the following error:

Error Component is not marked with EntityComponent Attribute

To begin with, I’m attempting to add CursorEntity which has following component:

[EntityComponent]
    class CursorComponent : EntityComponent
    {
        public Point Position { get; set; }
    }

Any help is appreciated, thank you.

EDIT: My bad, component class should be public

I’m glad you got the problem sorted out.

Just to let you know we’re currently working on a new ECS in MonoGame.Extended that won’t have these restrictions.

Components can be plain old classes and they won’t need the [EntityComponent] attribute. They also won’t need to derive from a base class or implement any special interfaces.

If you want to follow along with development I’ll be talking about this more on my patreon page.

1 Like