blueprint - The closer we get inside the radius, the more the value drops on the parameter posted by anonymous | blueprintUE | PasteBin For Unreal Engine
So I have my player character, a cube, and a sphere.
In the event graph of my cube, I wish to create a dynamic instance material that can change a scalar parameter from the material of my cube when the player character gets close.
Problem is, that doesn’t work, but when I have all that logic in my player character, exactly same setup, it works. So my question is, is this a limitation on how blueprints can communicate, or did I miss something?
For more context, I also had a sphere in the scene, who shares the same material as my cube, and I tried to change the scalar on that material when player got close to the cube. For the sphere it works, for the cube it doesn’t, even tho I’m trying to influence the exact same scalar parameter on the same material.
At first glance the only two potential issues I see are:
Material instance not applied to all components.
Character cast failed.
Here is a few suggestions:
If you want to know if it is the player character (possessed pawn) that is overlapping, you can do so by comparing references rather than casting.
If you want to search in a radius, use a sphere component set to Overlap rather than a trace. Shere comp will capture everything witin a radius and it’s event driven rather than checking every tick. If your player is spawning inside the radius then turn on Generate Overlap Events During Level Streaming.
Might be best to toggle Tick assuming it will do nothing when the player is outside the radius. Also reduce the tick interval…
Since both components have same material instance, only create 1 dynamic instance and apply it to both. Then only set the parameter to the one.
Use variables and parameters names without spaces.
Thanks for replying to me homie, I managed to fix it. I had to make a fresh blueprint, I copied the code over. I’m not sure exactly what the problem was tho…