seclerp / OxyEngine

:video_game: OxyEngine - 2D full-featured open-source crossplatform game engine
http://oxyengine.org
MIT License
18 stars 2 forks source link

NullReferenceException when creating FigureComponent post Load #62

Closed rufuszero closed 6 years ago

rufuszero commented 6 years ago

FigureComponent retrieves GraphicsManager instance on Load event. Since Load event fires once before game loop starts, creating instances of FigureComponent subclasses after Load event, in the Update, throws NullReferenceException because GraphicsManager was never retrieved for this instance.


Possible fix - creating any FigureComponent subclass adds it to the queue so it will be loaded on the next game loop iteration