Cannot Add Same Component

Hi, all.
i’m trying to add(the first) background to my game component but i have system argument exception “Cannot Add Same Component”.

if i remove the line adding component so the game executes(but it has an empty screen).

does anyone have any idea how to solve this or why does it happen?

Can you show a code example if what you are trying to do?

public Game1()

        Content.RootDirectory = "Content";
        IsMouseVisible = true;
        _graphics = new GraphicsDeviceManager(this);
        Components.Add(new Background(this, @"Sprites\BG", 1));


OK, and what does the Background class look like?
And can you screen shot the error you get too?

OK none of that is at all standard, and without seeing the entire structure of that code (the base classe and what they are doing, I am affraid I can’t help you out.

Does your Sprite base class already add itself to Game.Components???

you were right, thanks!

1 Like