I’m trying to set the parent for an existing Material Instance in my Event Graph but haven’t found a way to do so yet. I see this “Set Material Instance Parent” node listed in the online docs but I’ve been unable to locate it in the Actions menu even with “Context Sensitive” disabled. Is this node no longer available or am I misunderstanding how/where it is allowed to be used?
There it is! Thank you! Yes, I assumed I was trying to use it in the wrong type of Blueprint but it was not wholly apparent to me when reading the documentation (but then I’m still learning a lot about them). It is unfortunate (for me) that it can only be used in an editor utility widget as I was hoping I could use it to swap material instance parents at runtime but its good to know its there for use in editor utilities.
Changing a character’s material instance to use a variant of its current parent material which includes additional instructions (for extra features or material effects) while maintaining all of it’s original parameter values (texture assignments, scalar, vector, etc).
My hope was that if it behaved similarly to manually assigning a new parent in the Instance properties window that I could just swap the parents and keep everything intact as opposed to having to create a new Instance using the new parent on the fly and propagate all the parameter values from the old Instance to the new one. Ultimately, we would almost certainly end up doing this in code but I was hoping to prototype the basic material behavior via Blueprints.
Fwiw, if there are other ways to go about this that I’m not aware of I’m open to any other suggestions.
The Material I’m using as the new parent just uses a set of generic parameter values (texture, scalar, vector…). There is no version of it which uses the specific values set on the existing Material Instance currently assigned to my character asset so there is no other Instance to change to.
After your initial reply I did end up getting something working where I first use Get Materials to return an array of the Material Instances assigned to my mesh, then I iterate over that list creating (for each Instance) a new Dynamic Material Instance which uses the new parent and use CopyMaterialInstanceParameters to propagate the parameter values from the original Instance to the new one which I then assign to the appropriate index in the mesh’s material list. I can then restore the original Instances when desired by iterating over my array again and re-assigning them back to their original indices.