I wanted to make the ball in my game to go through a rainbow of colors. I use a material parameter collection and one parameter is in the ball_material in use. I change the value with a Timeline that last 6 seconds.
The Timeline goes through all the colors and applys an effect to the ball once and reverts it after it’s finished.
My problem is that it doesnt work every time.
I bound the P Key to the Timeline to Play from Start and after some testing, It does work sometimes and sometimes it doesn’t.
The effect applied works everytime but not the color change. Sometimes it works the whole game session. Sometimes it only works at the start once. Sometimes it works after some time passes.
It doesn’t matter if the key is held down or pressed rapidly. Held down doesnt do anything but pressed rapidly makes it start from the beginning rapidly, but only in cases where it works.
I have tried to google my way to a solution but at this point I just have no clue. Pls help.
Not entirely sure what the problem could be but it’s such a great title I had to respond. Are you replacing the material with a dynamic material instance?
Also, a few notes:
The DoOnce part: You’re basically doing the same thing as you would if you put the SetCollisionObjectType(SuperBall) before the timeline plays.
If you want it to play once and not play again until it’s finished, then try using the Play pin, and connecting Finished back around to SetNewTime (after you call SetCollisionObjectType(Pawn), of course).
Was literally gonna say the same thing about the DoOnce…i agree with @Jin_VE, move it before the timeline. Logically your set-up is doing the same thing but with blueprints and computers in general sometimes the real-life execution of the logic isn’t what we expect. So having a DoOnce after the timeline I think is just complicating things asking it to block input every frame except the first. Could cause random weird issues. I don’t have an issue with “Play from Start” that should work just fine as long as you don’t call it multiple times during the same play session, so the DoOnce node prior to the timeline would also help there, let the “Finish” pin loop around and reset the DoOnce that way you can’t call the timeline again before it completes play.
I don’t have much expirience but I had alot of problems with timelines not working.’
The DoOnce was put there so I could make sure, in case the timeline doesn’t start, the Collision Type wouldn’t be changed, but I didn’t want the timeline in case it works to set the collision type multiple times.
With the DoOnce, if the timeline worked, the collisiontype would be changed once.
Also, I found the problem. In the same Ball_Pawn Blueprint was another timeline ticking, changing the color in another way. I actually set up a stop in case of a powerup but forgot it completely. Explains why it somewhat worked but didn’t change color.
Hope I didn’t waste much of your time. Coming back here removing the DoOnce made me realize it, so thanks!