Why does my material get destroyed?

Hi, I am creating a dynamic material instance with UDynamicMaterialInstance::Create.
1 minute (nearly exact) after that, GetRenderProxy() causes an access violation.
I found out that I cannot call some of Resources[0] methods without violation, but Resources[0] is not a null ptr and my material either.

I don’t know what to do, maybe a dev can investigate.

Your material instance is getting trashed by garbage collection, engine do that by default every minute thas why it so exacly minute. Try adding UPROPERTY() before instance variable or that array, so engine will see it’s existance

Hey, I think i already use UProperty with both, my dynamic instance and material interface but i will check tomorrow. Thanks

It works :slight_smile: thx