Cannot find "Set Material (StaticMeshComponent) anywhere in 4.26

I picked up the “Blueprints Visual Scripting for Unreal Engine 4” lesson book and learning how to use scripting. At one point in the book, it teaches how to set materials to objects that are shot at. It asks you to search for the node “Set Material (Static Mesh Component)” and it is very specific. However, I’ve searched dozens of times with Context Sensitive on and off and I cannot find that specific node, but I see other users with screenshots showing that they have it. Am I missing something here? Was is renamed or something? I cannot complete the lesson as is without that specific node and it’s very disheartening. I am in UE4 4.26, while the book uses examples from 4.20.3, but claims it works in later versions like 4.22. I’d love to get some help with this please!

1 Like

You just need to drag off the reference, and look for ‘set material’. It might or might not have ( static mesh component ) in brackets, depending on the kind of thing you’re trying to set.

I did drag off and did the search for it, but I could only find Set Material or Set Material by Name. I could not find Static Mesh Component version anywhere.

‘set material’ is the right one.

I realize that now, but when I try to compile, it fails, and asks to connect to a target. The static mesh component node that is supposed to be connected to the set material is not present, and I don’t know what to add.


Here is a screenshot of the page in the book that demonstrates the Blueprint I’m trying to script. It involves adding a texture to a cylinder that will be shot at in the 1st Person Shooter format. This is the “Set Material (StaticMeshComponent)” node that is supposed to be used, but in 4.26 that’s nowhere to be found, and the basic Set Material node may look similar, but doesn’t seem to have the identical function. The major difference is that the node attached to the Target portion of Set Material is missing in 4.26. Is there an equivalent form of that node I need to use, or do I have to use a completely different set of nodes entirely to get the same desired effect?

You see in your picture, the target is set to the static mesh component

image

If it’s complaining about no target, and you haven’t set this, this will be why.

As an aside, using books to learn the engine would be wonderful, but it’s never going to work, I’m afraid. That’s because the engine is evolving so quickly, that any book will always be out of date.

If you put your code up here, I can look at what’s wrong.

I took a snapshot of the Event Graph I’m working in. When the set material node spawns, it appears by itself without any sort of Static Mesh Component attached to the target. The “Add Static Mesh Component” node was added on, but more needs to be done to this in order for the Blueprint to compile. Is there somewhere I need to go from here?

When you want to ‘set material’, you have to do that to something with material.

The most obvious thing is a static mesh.

I can see you’re in a blueprint, so it will be a mesh component. They are here

So you can just

setmat

1 Like

I see what you did there, but it’s still not quite what I’m after. The goal of the lesson was to have a cylinder in the level change color to red when it’s shot by a projectile. That is what the set material was for. Apparently it’s supposed to trigger a material swap once the cylinder is hit. Maybe I should’ve said that in the first place…

EDIT: It did indeed work. I’m just a dum-dum and wasn’t placing the object into the dang level. Sorry and thank you for putting up with me haha. I can confirm that my problem has been solved.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.