lurv Posted December 17, 2016 Share Posted December 17, 2016 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  https://i.snag.gy/sO1lwR.jpg  EDIT: Just checked and apparently the texture2d value is null, why is this? EDIT: Fixed Link to comment Share on other sites More sharing options...
Chronos Posted December 17, 2016 Share Posted December 17, 2016 I would assume because it's either not set anymore or never set before you get there. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now