Jump to content

ArgumentNullException for spriteBatch.Draw in monogame


Recommended Posts

So my game has code that checks for enemy spawns every 0.1 seconds.

I store my Enemy objects in a List<> and draw all enemy objects at their positions in a foreach statement in the Draw() method

Basically, my problem is that every time I add an Enemy to my List<> anywhere but Update or LoadContent it throws ArgumentNullException because some value is null?

It doesn't say which value is null, but it highlights my spriteBatch.Draw




EDIT: Just checked and apparently the texture2d value is null, why is this?
EDIT: Fixed

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...