Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7811831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:18:37+00:00 2026-06-02T04:18:37+00:00

Now the problem isnt that i dont know what the error means but i

  • 0

Now the problem isnt that i dont know what the error means but i cannot for the life of god figure out what could possibly be the cause of this. I’ve searched alot looking for answers, but the solution to my anguish eludes me. ive many times tried to overcome my obstacle but failed. Now i look upon you hoping for enlightenment, may you help my brain rest in peace 🙂

Here comes the problem:
Game1 runs and does its thing with my class named Abstakt:

class Abstrakt
{
    public ContentManager content;
    public SpriteBatch spriteBatch;
    public GraphicsDeviceManager graphics;

    MenuComponent menuComponent;
    StartGame startGame;

    public string gameState = "Menu";

    public Abstrakt(SpriteBatch spriteBatch, ContentManager content, GraphicsDeviceManager graphics)
    {
        this.spriteBatch = spriteBatch;
        this.content = content;
        this.graphics = graphics;
    }

    public Abstrakt() { }

    public virtual void Initialize()
    {
        menuComponent = new MenuComponent();
        startGame = new StartGame();

        menuComponent.Initialize();
        startGame.Initialize();
    }

    public virtual void LoadContent()
    {
        menuComponent.LoadContent();
        startGame.LoadContent();
    }
}        






class MenuComponent : Abstrakt
{
    SpriteFont spriteFont;

    public MenuComponent() { }

    public override void LoadContent()
    {
        spriteFont = content.Load<SpriteFont>("GameFont"); <--Here the problem appears
    }
}

Ive removed code that was unimportant so it would be easier to view. th problem is:
Object reference not set to an instance of an object.

Thanks for any help and advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:18:40+00:00Added an answer on June 2, 2026 at 4:18 am

    I think that you don’t initialize the “content” variable.

    if you instance a MenuComponent with the default no parameters constructor, content is not assigned.. so it will be equal to null…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I set up the basic Authentication/Authorization set up, but a problem now is that
i m using jQuery tablsorter plugin, it's working perfect,but now problem is ... i
I would like solve the problem (now hypothetical but propably real in future) of
I'm having (many, but for now,) one problem with a project I'm working on.
So what my code looks like.. Now the problem is that Everything is fine
I'm onto problem 245 now but have hit some problems. I've done some work
I dont know whether bidirectional means i can write rbegin() or if i can
I have a class that reads configuration. Now the problem is that I don't
I've been trying to solve a slow trigger problem and now that I have
I am trying to make a chatroom layout like the following: Now my problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.