I have set a spotlight in my blueprint that and trying to turn up the intensity when i hold a key. The thing is that it keeps the light on as long as the key is pressed, but when i release it, it goes back to 0. Anyway to keep the last intensity value when i release the key?
“In both C++ and Blueprints, Axis
events will fire every frame passing
the current value of the Axis while
Action events will have the Pressed
and Released outputs fire as the
key(s) are pressed.”
If you release the input axis, it will have the input 0 and sets the intensity to 0.
If you want to keep the intensity, you could include a check against 0 for the input value or a check for new intensity to be greater then your old intensity.
If you want to check the new value to be greater then the previous value, create a float variable e.g. called “PreviousAxisValue” and use the “Compare Float” node to check if your current value is greater, equal or smaller then your previous. After that you can execute “Set Intensity” when your current value is greater. After that, store your axis value in the variable “PreviousAxisValue”.