Hello,
Here in the image below, I am instantiating static mesh components through a construction script inside a blueprint class (There is a for loop before since i need as many static meshes as many times the loop will run). Then, I am adding each of the static mesh components into a static mesh component array and creating a dynamic instance material and storing them in a separate array of their own.
I made it in this way, since I want the lightbulbs (the static mesh components) to glow when the player looks at them and turn off when the player is not looking.
In the image given below, is the event graph where I am using a raytrace from the player camera to check if the player is hitting the light bulb or not. If it hits, I am getting the index of the hit light bulb’s dynamic material from the Dynamic Material Instance array I made earlier in the construction script and changing the parameter. (the parameter nodes are set in the material).
For some reason. this setup doesn’t work and I can’t figure out why. Please point out what I am doing wrong here.
Thanks