XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

How do I set the Game.Content property to a different instance (a custom subclass)?

Last post 12/21/2007 1:30 PM by ShawMishrak. 3 replies.
  • 12/21/2007 12:56 PM

    How do I set the Game.Content property to a different instance (a custom subclass)?

    The Game.Content property is readonly.  Shouldn't there be at least a

    protected virtual ContentManager CreateContentManager()

    method that I can override to provide my own subclass?

    Not too big a deal, since I can just create and use a different content manager, but seems to be a design oversight, since such an un-extensible coupling doesn't seem to be necessary.
  • 12/21/2007 1:08 PM In reply to

    Re: How do I set the Game.Content property to a different instance (a custom subclass)?

    Is there any reason why you can't just use the constructor as in this below?

    ContentManager contentManager = new ContentManager( Services );



  • 12/21/2007 1:12 PM In reply to

    Re: How do I set the Game.Content property to a different instance (a custom subclass)?

    I think the OP's complaint is that the Game class's Content property cannot be set. It is get-only. So he will wind up with two ContentManagers floating around.
  • 12/21/2007 1:30 PM In reply to

    Re: How do I set the Game.Content property to a different instance (a custom subclass)?

    That's actually a good point if you use custom ContentManagers.

    I would file a suggestion on Connect.
    Microsoft DirectX/XNA MVP
Page 1 of 1 (4 items) Previous Next