Download

Change default material on child blueprint

I’m working with the rolling ball template and I would like to have a few different balls with different colors and properties. How do I go about exposing the default material for the root mesh in the child blueprints? If this is not possible, would I have to set the material in the construction script of each child blueprint?

Check out the Thrid Person Tutorial series on you tube. In it he creates a material and then goes through the process of creating instances that can be changed.

You can check this. He use dynamic material instance to spawn toy cows of various sizes & colors.

Ok, so I can’t change the components of the parent blueprint in any way in the children?

Do you meant blueprint instances?

BP child of BP_A-> made by create a BP, & pick BP_A as parent.

BP Instance -> An instance of a BP, craete by dragging a Class BP (Say BP_A) to a level. Each time you pull out one, an instance is create.
Its normally named BP_A, BP_A1, BP_A2

In any case, you can change material properties of the parents, but in order to do so, the parent or class blueprint must use a Material Instance, not the original material. You will see as you look at the tutorial I posted.

I’m referring to child/parent bp. I have a parent pawn which handles input, etc and the child classes have different jump strength, speed, physics properties. I’m still transitioning from Unity so a lot of the Unreal methodology is still foreign to me.

Since we have to create a dynamic material instance for each instance of the child bp, do they end up getting batched when rendered? Thanks for the help.

Class BP methodology is just like C++ Object oriented Programming if you are familiar with it. Every child inherit the properties of the parent, & you can add/modify the child to add more functionality.

You just have to create a dynamic material instance once, in the parent, or child BP. Then you can change the properties of each instance under details or runtime, depends on your need.

My c# is decent, c++ not so much. I had just assumed that the components of the parent class would be treated like protected variables.

In UE4, they are public by default (I think), like Unrealscript, but you can set it under variable details. Also component in UE4 refer more to actor character, static mesh etc.

You can look up material tutorial to understand how material works in UE4. It required quite a bit of set up, but it also very flexible & powerful.

Normally, a material have constants. You cannot change constants. If you want to change color (for example), you need to connect color to a Vector 3D parameter. On top of that, in UE4, you are not allow to change the original Material with the color material, you need to make an instance Material out of the base Material. Think of each material instance as a object of a material class, & the original base material is the material class.

Attach the Material instance of the Materialclass in the parent BP, then you will be able to change the colorParameter in both Parent class & child class. The tutorial I post above shows how its done.