Triggering Simple Commands Within Actor BP

So the main thing is your standard actor won’t take input events directly, You’re better off passing it from whatever is reading your input (character, controller) with a function or event call.

The other thing is, you pay a tradeoff with instanced static meshes. Their performance boost comes with the drawback that they are not really meant to be edited at runtime and I find that if I need to do anything with a mesh during runtime I just have to use a proper static mesh.

Hopefully that answers your question.

Hello!

I have an actor BP made up of 5 or so instanced static meshes and instanced throughout my scene. I now want to switch the materials with a keyboard key “X” in this condition but nothing is working. I have this in the actors event graph: X key triggering set material to one of the instanced static meshes, very simple BP but its not working no matter what i do. Any ideas?

Hey Bizmark, to clarify, you’re saying I should use a function to do this? that should work? This is a VR project, so the performance gained is VERY helpful, I understand what you’re saying about instances but I only really need to switch out the materials on these instances, and they all need to be the same when they switch too, so hopefully that should be ok.

Maybe I’m asking the obvious but have you put this in your level blueprint?

Otherwise the event simply won’t fire.

Have you tested if the input goes through with a Print String?

Also your logic sets 4 different materials to the same object (the fourth is double).

You should also check if your Headrest object isValid.

No as Schnittbrot mentioned it won’t fire in an actor because they do not take input events (unless you set them up to, there is documentation available if you really want to). It’s better to trigger this another way and a function is a simple way to do that, referenced from somewhere that will take the input event if that’s how you want to trigger it. This is by no means the only way to do it just one suggestion.

If you really want to use instanced static meshes you can select the materials that are being applied to them and make sure that “Use with instanced static meshes” is true. I can’t speak to whether this will result in the gains from the instanced static meshes becoming void or not.

Also just to reiterate Schnittbrot’s point when referencing something, it’s always good practice to run it through an IsValid just for safety.