Is there a way to change the parent material of multiple material instance all at once? For example, I have 50 material instances and I want them to all have the same parent material.
I have tried scripting it with a blueprint but havent had any luck.
Be careful: this doesn’t have any check inside it, be sure to select the correct materials and the correct parent path!
Always try with a single asset before running a batch!
Did you set the correct path in “default_material_path” (it has to be the parent material path).
Are you selecting the materials instances to reparent when launching the python script?
That error really doesn’t ring me any bell, I’d make a plugin in C++ and share it with you but right now I’m pretty busy, sorry
MaterialReparenterUndo.zip (509.0 KB) (Safer)
Mark the assets as modified (and you can undo the operation with CTRL+Z), you need to save them manually to make the edit permanent.
OMG Thanks for the plugin!!
Btw, did you use ‘SetParentInternal’ c++ function for this plugin?
I really want to know what caused the crash, and if you share c++ code for me, it would be also greatful…
Yeah! I checked the BP you gave to me
The reason why crash occured was because I did not access to material directly, but access it via static mesh actor. Not 100% sure, but the BP you made didn’t occur the crash.
I’m sorry that I did not post the original question, so I cannot mark the solution…
Truly thank u for solving the problem, thanks for spending your precious time for me, you made my day
Remember, if there’s the word “actor” it means that they are placed in world, if you have to access assets in editor you need to cast “selected asset” to its specific class and then use the function that you need (in this case to replace the parent)
Oh, I’m sorry, I didn’t notice it.
Don’t worry, I flagged the post and a mod has already marked it for you!
You are very welcome, I’m happy that it worked and I shared it because I think it could be useful to other useful to other users in the future (because this is an issue that could occur very easily).
That’s why imho it’s important to “mark a thread as solved”, when I’m looking for a solution I try to avoid posts that don’t have one (sometimes they can point you the right direction where to look but you have to find a way by yourself!)
Has anyone gotten the plugin from @Ares9323 to work with material instances/interfaces as the parent? Nearly every time I try it with those my editor crashes.
Which engine version are you using?
Have you tried using it with few instances at a time? (There could be an issue with some material in particular that may cause your crashes)
That’s good to know, but knowing Unreal I would have expected something similar
Probably, there’s a way to automatically close windows of instances before doing the replace but I didn’t think about that when I posted it (because it was a simple script made to help the OP).
It’s always better to close editor windows when you are renaming/moving/replacing stuff (and don’t forget to use “Fix Up Redirectors” after moving files, especially if they have references and you’re using source control)