Async Dynamic Texture Update

Hello guys. Im working on fog of war (made by tutorial), but updating texture ‘eats’ too much fps, so i wanted to make updating async, but when i use Graph Task System - i get crash with updating textures - Assertion Failed - IsInGameThread().
Any ideas?

When I tried to read texture data once per Tick it was way too slow, because of the locking and probably streaming required in the background.

I ended up caching the entire texture data in my class as array. Maybe you can do the same - read the texture once and update the data in your own array.
When required (e.g. when enough data has changed) you can write the whole texture at once in the game thread.

It is generally not a good practice to work with transient objects like Texture2D objects that can be garbage collected at anytime. That being said, you are getting that assertion failure due to calling


This should only be done/called in the GameThread, lest you wish to meet a whole stack of editor crashes and fatals.

I am aware that this is a couple years late. Leaving this for anyone else who comes through :smile:

Pray this helps.