I am trying to load up a single SpriteFont to print some debug information. In our current game, we load up both Textures and Music through a ResourceManager. They are both loaded with a filestream, and thus do not require Content.Load

SoundEffect soundEffect = SoundEffect.FromStream( fs );

Since this ResourceManager does not inherit from Game or is like Game.cs, I cannot use the usual method:

SpriteFont spriteFont = Content.Load<SpriteFont>(resource.Key.Item2);

Anyone have any idea how I can either: -Load the SpriteFont a different way -Create my own Contentmanager

  • 1
    \$\begingroup\$ Just send Content as parameter to the other class? This is generally how it's made. If you have a scene class(for example, not necessarily) you usually pass content (or entire game) as parameter to the class creator. So you can create your resources in there. \$\endgroup\$ Commented Mar 21, 2012 at 4:35

1 Answer 1


You could do what Gustavo - Gtoknu said and pass the content manager variable into your ResourceManager class OR you could create a new content manager. You'd have to have a reference to your main game class, but this is the idea:

ContentManager content = new ContentManager(myGameRef.Services, "Content");

Where "Content" is the root directory to load content from.

Keep in mind that when the content variable is disposed, so are all the resources associated with it (ie. anything you loaded), so you want to keep it in scope until you're done with the resources it loaded.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .