title: StackoverflowException Unhandled -Know the cause, don't know how to fix
body: <p>I currently have 3 .cs files for my game, these being Game1.cs (main file), Player.cs and HUD.cs, currently I am stuck in a loop whereby the Game1.cs class creates a new HUD object that creates a new Game1 object etc. Code below (working w/ XNA framework btw).</p>
  
  <p>HUD.cs</p>
  
  <pre><code>public class HUD
  {
      public Texture2D HUD_main, HUD_stamina, HUD_sBarDepleted, HUD_mana, HUD_health, HUD_money; //HUD TEXTURES
      public int staminaWidth, manaWidth;
      public SpriteFont HUDFont;
      Player_Main pmain = new Player_Main();
      Game1 gamecore = new Game1();
  
      public HUD()
      {
  
      }
      public void Update(GameTime gameTime)
      {
          staminaWidth = (int)pmain.pstats.currentStamina * 2; //Updating width of stamina bar based off of current stamina
          pmain.pstats.staminaDisplay = Math.Round(pmain.pstats.currentStamina); //Separate variable for the stamina that shows on screen so it doesn't print decimals
  
          manaWidth = (int)pmain.pstats.currentMana;
          pmain.pstats.manaDisplay = Math.Round(pmain.pstats.currentMana);
      }
      public void LoadContent(ContentManager Content)
      {
          HUD_main = Content.Load&lt;Texture2D&gt;("HUD/HUD");
          HUD_stamina = Content.Load&lt;Texture2D&gt;("HUD/staminabar");
          HUDFont = Content.Load&lt;SpriteFont&gt;("HUD/HUDFont");
          HUD_sBarDepleted = Content.Load&lt;Texture2D&gt;("HUD/bar_depleted");
          HUD_mana = Content.Load&lt;Texture2D&gt;("HUD/manabar");
          HUD_money = Content.Load&lt;Texture2D&gt;("HUD/moneybar");
          HUD_health = Content.Load&lt;Texture2D&gt;("HUD/healthbar");
      }
      public void Draw(SpriteBatch spriteBatch)
      {
          spriteBatch.Draw(HUD_main, new Rectangle(0, 0, gamecore.viewportWidth, gamecore.viewportHeight), Color.White);
          spriteBatch.Draw(HUD_sBarDepleted, new Rectangle(100, 0, 200, 20), new Rectangle(0, 0, 200, 20), Color.White);
          spriteBatch.Draw(HUD_stamina, new Rectangle(100, 0, staminaWidth, 20), new Rectangle(0, 0, staminaWidth, 20), Color.White);
          spriteBatch.Draw(HUD_sBarDepleted, new Rectangle(100, 20, 200, 20), new Rectangle(0, 0, 200, 20), Color.White);
          spriteBatch.Draw(HUD_mana, new Rectangle(100, 20, manaWidth, 20), new Rectangle(0, 0, manaWidth, 20), Color.White);
          spriteBatch.DrawString(HUDFont, pmain.pstats.staminaDisplay + "/" + pmain.pstats.maxStamina, new Vector2(175, 0), Color.White);
          spriteBatch.DrawString(HUDFont, pmain.pstats.manaDisplay + "/" + pmain.pstats.maxMana, new Vector2(175, 20), Color.White);
          spriteBatch.DrawString(HUDFont, "Ability: Cooldown", new Vector2(20, 40), Color.White);
          spriteBatch.DrawString(HUDFont, "Teleport: " + pmain.pabilities.spellDisplay1 + "s", new Vector2(20, 60), Color.White);
      }
  }
  </code></pre>
  
  <p>Game1.cs</p>
  
  <pre><code>public class Game1 : Microsoft.Xna.Framework.Game
  {
      GraphicsDeviceManager graphics;
      SpriteBatch spriteBatch;
      Player_Main player = new Player_Main();
      HUD HUDmain = new HUD();
      Texture2D grass1; //MAP TEXTURES
  
      public int viewportWidth, viewportHeight;
  
  
      //Classes
  
      public Game1()
      {
          graphics = new GraphicsDeviceManager(this);
          graphics.PreferredBackBufferWidth = 1280;
          graphics.PreferredBackBufferHeight = 720;
          Content.RootDirectory = "Content";
          this.Window.Title = "Honour In Blood: Rise Against Rome";
  
      }
  
      /// &lt;summary&gt;
      /// Allows the game to perform any initialization it needs to before starting to run.
      /// This is where it can query for any required services and load any non-graphic
      /// related content.  Calling base.Initialize will enumerate through any components
      /// and initialize them as well.
      /// &lt;/summary&gt;
      protected override void Initialize()
      {
          base.Initialize();
      }
  
      /// &lt;summary&gt;
      /// LoadContent will be called once per game and is the place to load
      /// all of your content.
      /// &lt;/summary&gt;
      protected override void LoadContent()
      {
          // Create a new SpriteBatch, which can be used to draw textures.
  
          spriteBatch = new SpriteBatch(GraphicsDevice);
          grass1 = Content.Load&lt;Texture2D&gt;("grass1");
  
          viewportHeight = GraphicsDevice.Viewport.Height;
          viewportWidth = GraphicsDevice.Viewport.Width;
          player.LoadContent(Content);
          HUDmain.LoadContent(Content);
  
      }
  
  
      protected override void UnloadContent()
      {
      }
  
      /// &lt;summary&gt;
      /// Allows the game to run logic such as updating the world,
      /// checking for collisions, gathering input, and playing audio.
      /// &lt;/summary&gt;
      protected override void Update(GameTime gameTime)
      {
          KeyboardState KS = Keyboard.GetState();
          // Allows the game to exit
          if (KS.IsKeyDown(Keys.Escape))
              this.Exit();
  
  
  
          //Making edge of screen stop player movement to prevent going off-screen
          if (player.pmove.position.X &lt; 0)
              player.pmove.position.X = 0;
          if (player.pmove.position.Y &lt; 0)
              player.pmove.position.Y = 0;
          if (player.pmove.position.X + player.psprite.player.Width &gt; GraphicsDevice.Viewport.Width)
              player.pmove.position.X = GraphicsDevice.Viewport.Width - player.psprite.player.Width;
          if (player.pmove.position.Y + player.psprite.player.Height &gt; GraphicsDevice.Viewport.Height)
              player.pmove.position.Y = GraphicsDevice.Viewport.Height - player.psprite.player.Height;
          //
  
  
  
          player.Update(gameTime);
          HUDmain.Update(gameTime);
          //
          base.Update(gameTime);
      }
  
      /// &lt;summary&gt;
      /// This is called when the game should draw itself.
      /// &lt;/summary&gt;
      protected override void Draw(GameTime gameTime)
      {
          GraphicsDevice.Clear(Color.CornflowerBlue);
          KeyboardState KS = Keyboard.GetState();
  
          spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null); // TILING
          spriteBatch.Draw(grass1, new Rectangle(0, 0, viewportWidth, viewportHeight),new Rectangle(0,0,viewportWidth,viewportHeight), Color.White); //TILES BACKGROUND TO RESOLUTION OF WINDOW
          player.Draw(spriteBatch);
          HUDmain.Draw(spriteBatch);
          spriteBatch.End();
  
          base.Draw(gameTime);
      }
  }
  </code></pre>
  
  <p>How can I use variables from game1.cs in my hud class without having to create a new object?</p>