x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to Destory the Dynamic Material Instance in memory?

I make a Dissolve Effect BP in my weapon when I destroy object it will have a dissolve effect, so... The dynamic material instance will not destroy together with the object and be there forever. How can I destroy the Dynamic Material Instance when it can not disappear? ![alt text][1] [1]: /storage/temp/214743-dynamicmaterial1.png

Product Version: UE 4.16
Tags:
more ▼

asked Sep 26 '17 at 09:17 AM in Blueprint Scripting

avatar image

mottH
15 5 8 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Blueprints have a Garbage Collector. Any object that is no longer referenced in the world will be automatically destroyed (edit: I meant deleted). If you set the MaterialInstanceDynamic variable to null, the GC should kick in and remove it from memory.

I believe the system received a performance boost in 4.16 or 4.17, so this happens pretty quickly.

In your case, I'd set the parameter controlling the opacity of the effect to 0 and clear the referencing variable or destroy the actor that stores it.

more ▼

answered Sep 26 '17 at 10:25 AM

avatar image

Everynone
15.2k 77 25 62

avatar image mottH Sep 26 '17 at 10:50 AM

Thank you, let me test first.

avatar image mottH Sep 26 '17 at 11:29 AM

I add a Set Texture Parameter Value note to make the texture null, it works...but before the DynamicMaterialInstance disappear the texture will go back to the gray grid Texture. I don't want this shows up. So I add an Opacity note and then set null, but the result goes back to the beginning...

dissolvebp.png (106.5 kB)
avatar image Everynone Sep 26 '17 at 07:22 PM

So, hold on. You create a MID in the weapon blueprint and apply it to the target of the weapon. The target gets destroyed. So far so good.

I'd simply set the MID reference to null and forget about it:

alt text

capture.png (97.5 kB)
avatar image mottH Sep 27 '17 at 12:14 PM

![alt text][1] Thank you first. I try you note, it will become this all gray, sometimes it will disappear, sometimes don't (゚Д゚≡゚д゚)!? Perhaps no way to solve the problem with Blueprint ... [1]: /storage/temp/214864-dynamicmaterial2.png

avatar image mottH Sep 27 '17 at 01:32 PM

I know where the problem is, probably because of my DestroyActor read and isValid? Node problems, i will solve it but not soon, thank you very much! ![alt text][1] [1]: https://answers.unrealengine.com/storage/temp/214887-dynamicmaterial3.png

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question