Why does my code give NullPointerException error?

Hello @prathmesh,

There are lots of resources (tutorials, references, examples, etc.) here:

Related to your topic:

Be careful to scrutinize code carefully and learn from it.

The code that was removed had the tex.endDraw() inside the loop which may not yield the intended or desired results.
You can try it inside the loop and outside of the loop to see the difference.

Have fun!

:)

1 Like