[SOLVED] - The mistake was mine, that I didn't link World (world_) to the entity, so that was null. Thanks for the explanation everyone!
As you may know by now, I'm making a game engine/framework, and I've got stuck linking stuff with references to each other.
Example:
public void Attach(Entity Entity)
{
entity_ = Entity;
entity_.world_.renderer_.AddComponent(this);
}
The line that adds component to the renderer fails with NullObjectException. My idea was that it's because it's inside the class implementation (when the object isn't defined yet), but such thing worked in next piece of code:
public TGSGame()
{
...
Renderer = new RenderManager(this);
...
}
That part of code is inside TGSGame class implementation too!
Does anyone have idea how can I overcome this exception?