Attempting to use Entity.Attach Errors On <T> for all classes

I have been trying to replicate some of the code from the platformer demo in the GitHub and in particular I wanted to get an animated sprite from a sprite sheet. When I use the block of code below after creating the appropriate classes from the demo I get an error for every instance of entity.Attach

entity.Attach<AnimatedSprite>(new AnimatedSprite(animationFactory, "idle"));
entity.Attach(transform);
entity.Attach(new Body { Position = position, Size = new Vector2(32, 64), BodyType = BodyType.Dynamic });
entity.Attach<Player>();

For the first line I get "cannot convert from MonoGame.Extended.Animations.AnimatedSprite to System.Action<MonoGame.Extended.Animations.AnimatedSprite>
The next two say they cannot infer the type argument for Attach(Action configure)
The last gives me an error that says Player cannot be used in place of because it is never explicitly named an EntityComponent even though I have the [EntityComponent] above the class declaration.
Any advice?

Ah well… that is strange.

I mean, I kind of understand what the errors are saying but I’m not exactly sure why. Essentially you’re talking about these two method overloads:

    public T Attach<T>(T component) where T : class
    {
        return Manager.AddComponent(this, component);
    }

    public T Attach<T>(Action<T> configure) where T : class 
    {
        var component = Attach<T>();
        configure(component);
        return component;
    }

The first error seems to indicate that it’s trying to use the second method that takes a configure action but actually it should be using the first.

The next two are also trying to use the second method but this time it’s having trouble resolving the type T automatically.

The last error… wait a second…

I think you might have a version mismatch going on? Are you referencing the 1.1 NuGet packages? The code you’ve posted is probably from the 2.0 demos.

Btw… lots of things are changing in the develop branch right now making way for 2.0. The ECS in particular is getting a complete overhaul so anything you do now will definitely break.