Initialization Code in UDataAsset Constructor or Somewhere Else?

Do you need to scan in the constructor? Are these textures something you can scan at edit time and simply store the data in a UDataAsset rather than actually scanning the data each time? You could potentially use PostEditChangeProperty to rescan a texture as you assign / change it (or on other actions depending on what you need).

If this is something you need to scan dynamically at runtime then I’d probably opt to have a manager which maintains a list / map of structs (which contain your processed data). Simply ask the manager to process a new texture, or retrieve the results on an existing one. There’s less overhead for allocation this way and potentially its easier to multi-thread if needed.

1 Like