Problems with a material changing blueprint on key press

So as a complete blueprint noob I’m having a lot of trouble dealing with a few errors I’m getting on this blueprint.

What I want the blueprint to do is:

  • Make 3 balls representing the different materials appear when colliding with a volume.
  • Start off with one of those balls outlined representing the current material
  • Change the material and the outlined ball when pressing a key

And it’s doing all that, BUT, I couldn’t find a way to make it so that the first ball is outlined when overlapping the first time and also leaving the trigger volume leaves the outline visible even though everything should disappear.

I’m also aware that this is probably the dumbest and least efficient way of doing something like this but hey, I’m learning (I’d also gladly accept a good way to do this from the scratch instead of how to fix this mess).

Here’s the whole blueprint and how it looks on in-game, feel free to ask me any questions about it

Thanks for your time!

how are you handling the outline? ive got some ideas on how to solve your issue and make it easier to implement but im not sure on how your handling the outline bit.

The outline is just a copy of the balls with a material that makes it look like an outline.

And what the blueprint does is cycle through 2 outlines being invisible and and being visible so there’s always just 1 ball outlined.

ok so this may be a little much and not exactly what your looking to use since it doesnt use your existing setup but maybe it will be of some help to you. so i recreated your setup but in a modular reusable way. the idea here was that you can switch out the mesh and the material based on arrays. the number of spheres showing the material options would update according to how many materials are in the array. the short of this is you can use this actor as a master for any type of furniture (mesh) and apply any material to it, if you want a couch you can create a child of this master and add couch meshes to the array.

anyways on begin play we set the mesh and material to the first in their respective arrays. then we create the material spheres to display the material options by using a for each loop and a add static mesh, we also set the material and the visibility of the mesh here.

on begin overlap with the actor we make sure its the player overlapping, enable input to the actor, and set the visibility of the material spheres. we do almost the same for end overlap. on begin overlap we also set which sphere to outline, in this example i used a point light to light the sphere but if you look at the bottom of the second picture you will see i also included if you were going to use custom depth and post process (link to [tutorial][1]).

for switching the meshes and materials i used a simple method of using a int variable as a index or rather to keep track of the current index in the array. so when we press the 2 key we get the material index variable and increment it. then we do a check to make sure its a valid index in the array by getting the materials array, get last index, and check if material index variable is greater than the last index in the array, if yes we set the variable to 0. then we set the material of the current mesh to the one at the appropriate index in the array. after that we need to update the outlined mat sphere by using the same method we used before.

this may all look complex but its not too bad once you break it up into the little individual parts. i admit i probably went a bit overboard with this haha. if you have questions let me know.

You surely went overboard but ■■■■ is it amazing!
That’s all I wanted to have and much more plus being able to easily use it on many different props unlike whatever monstrosity I was doing earlier.
Though I do have one question: I may not be using the right type of variable or something like that but what’s supposed to go in there?

http://prntscr.com/n5gsy0

I don’t seem to have any static mesh component nor do I know what it is exactly and it seems like that making it so that my materials won’t switch and I get this error:

http://prntscr.com/n5gw4u

nope it didnt post.

edit: it looks like you tried to post again and it failed. are you getting any messages about it needing moderator approval? then again you may not be able to comment to reply haha

Hello Nightmare,

Please stop trying to circumvent the moderation process. We got every message, and it was being moderated in all cases because you used the word “■■■■”.