Garbage Collection of UMaterialInstance objects stored in TMap
I'm having issues storing a
I've tried using
The thought crossed my mind to store those materials in a
Since TMaps can't be used with UPROPERTY(), I can't use that pattern to prevent the material instances created at runtime from being GCed. I've also tried using
Any help would be greatly appreciated!
asked Mar 11 '14 at 02:39 AM in C++ Programming
ue4-archive ♦♦ STAFF
Just a note for anyone currently running into this issue before TMaps become compatible with UPROPERTY() - I ended up preventing the crash by also storing materials created at runtime in a TArray, declared as such:
Then, when when creating a new dynamic material instance, I did this:
Thanks for the help, guys. This workaround seems like the best solution for now, and should be no problem to remove once TMaps work with UPROPERTY(), since my code makes no other use of the HackToStopEditorCrash array and any lines referencing it can then safely be deleted.
Why Need TMap?
Why do you need a TMap instead of just using a TArray and setting up all the proper accessors?
I am quite curious,
I am not presuming I know one way better than another, just want more info as to why TMap is your preferred design choice
Follow this question
Once you sign in you will be able to subscribe for any updates here