I am playing around with decals that spawn as a result of projectiles hitting surfaces. I have a red decal, and now I’m trying to add a green decal, and I’d like to be able to swap between them with a keypress (such as tab).
So, each time tab is pressed, I have some scripting that sets my ColorMaterial variable either to DecalTest2 or DecalTest3. That part works fine, but it’s in the FirstPersonCharacter class (I’m working off the FPS example).
Now I need my FirstPersonProjectile to be able to retrieve that variable, so that when it hits a surface, it knows what color decal to spawn. This is the part I’m having trouble understanding.
I’ve created a blueprint interface called “PassColor”, and added it via Class Settings to both FirstPersonProjectile and FirstPersonCharacter. Why does it allow me to change the functionality for the interface to make it different between each of them? Either way, what I have isn’t working. Some help would be greatly appreciated!
Thanks for replying. It seems part of my mistake was implementing the blueprint interface into both the Projectile and Character blueprints. Correct me if I am wrong, but I only need to implement it in the Character blueprint, then call the “Pass Color” function from the Projectile blueprint?
Anyway, one I call the Pass Color function, it gives me a couple of errors. It seems to want input, but I only want the output. How do I simply “get” the material variable without having to input a material and a target? Why it is targeting “self”?
EDIT:: Would just like to note that I finally figured it out. I needed to delete the input variable, as it was unnecessary, and I needed to set the target to the player instance (get player character). Woohoo! Anyway, thanks for the help - you got me set on the right track. I hope this information helps other people out.
Should be able to right click inside your projectile blue print and search for the “pass color” function node. I did this recently as well, ill show you my projectile blueprint, only difference is i didn’t use a very good naming convention (i really need to change that) and my functions called new function 0 wheres your function is called Pass Color.
Yea some of the tutorials out there are not so clear on this. Happy to help, might wanna set it to resolved.