SetVectorParameterValue working only for the 1rst time?
Hey guys, I've been struggling with this for the past 2 days and havent been able to figure this out, im pretty sure is something really simple that I'm missing, so maybe anyone can help me :)
What im trying to do: Change a color through a function
In theory after calling "BeginPlay" the color of the is yellow.
Later in the code I call this function:
With this value: SetSegmentColor(1,0,0); //<-- change the color to red
But the color stays Yellow! :S. Any idea what's happening here?
One more thing; I noticed that if I dont put any code in BeginPlay (regarding changing color) and then call the function SetSegmentColor() it changes its color how it should... :/ Thanks a bunch!
asked Feb 10 '16 at 10:02 PM in C++ Programming
When your BeginPlay function is called, you create a new DynamicMaterial having the originalMaterial as a parent. When SetSegmentColor is called you create a new DynamicMaterial having the new DynamicMaterial from BeginPlay as a parent. A DynamicMaterial can't be a parent for another DynamicMaterial.
Try getting rid of the creation of the DynamicMaterial in your SetSegmentColor function and keep the rest and that should fix your issue.
Let me know if that works.
answered Feb 11 '16 at 04:45 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here