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"

Can't save MaterialInstanceDynamic created via C++

 Can't save D:/Documents/Programming/Unreal/DMI_Bug/Content/MyMap.umap: Graph is linked to private object(s) in an external package.
 External Object(s):
 MaterialInstanceDynamic_0
   
 Try to find the chain of references to that object (may take some time)?

I've reproduced the bug in a standalone project and attached it here. To get the message, simply create an instance of MyActor (a C++ class) and then save.

link text

Product Version: UE 4.22
Tags:
dmi-bug.zip (1.1 MB)
more ▼

asked Jul 09 '19 at 10:38 PM in Using UE4

avatar image

ngzaharias
21 1 4

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

2 answers: sort voted first

quick update, it looks like by changing the OUTER of UMaterialInstanceDynamic::Create gets this to work changed from MeshComponent -> NULL

edit: this is a bug, not a question, not resolved

more ▼

answered Jul 10 '19 at 03:37 AM

avatar image

ngzaharias
21 1 4

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

Okay, after trying a couple of things i think this is the best way to go. As i said earlier, dynamic material instances are made to be created and edited during runtime so i suggest creating a constant material instance based on the material you wanna edit and using that in your constructor instead of the dynamic one, which will save just fine.

And if you want to edit it at runtime, just create a dynamic one based off of it and change its parametes, here's the code i set up.

.h

alt text

.cpp

alt text

Here's my in-editor setup with a material instance constant set to a red value, level and actor both save fine because the instance isn't dynamic.

alt text

At runtime, a dynamic one is created and set to the mesh.

alt text

6.png (42.0 kB)
5.png (18.4 kB)
3.png (135.5 kB)
4.png (120.6 kB)
more ▼

answered Jul 11 '19 at 09:08 PM

avatar image

Moe Wattar
223 4 5 7

avatar image ngzaharias 5 days ago

thanks for the help dude, I'll give it a go tonight when I get home

avatar image ngzaharias 4 days ago

alright yeah that does indeed work better, but it seems to have the same outcome as making a dynamic that has no outer. I guess there isn't anyway around having to store the material settings (not the worst thing).

I might look into creating a material instance with the params I want and saving it to the content browser (probably not though)

thanks for all the help! I assume that material instance dynamic settings are never meant to be saved ?

avatar image Moe Wattar 4 days ago

No problem! You can save the instance settings some other way like you said but the dynamic instance still has to be created and edited during gameplay.

(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