Attribute Decreases at Different Speeds FPS

KO_Games

Member
Hi Justin,

I'm using the attribute manager to control the stamina my character has in my game for running. The stamina decreases while a button is pressed to make the character run with the speed change ability.

However, I noticed an odd issue where it seems that the stamina meter will decrease at different speeds depending on how many frames the game is currently running at (this might be an intended behaviour or the fault on my part). For example, if my game is running around 100 fps the stamina will increase and decrease as I am expecting. However, if the frames drop down to 30 fps the stamina will increase and decrease very slowly (which then essentially allows the player to run for a much longer period of time than I want them to be able to in the game before running out of stamina).

My guess is that the stamina is decreasing based on the fps instead of real world time. If this is the case, is there a good reason for it to decrease this way rather than decrease in real world time while the button is held down? Is there a way to make it so the stamina will decrease at roughly the same speed regardless of the framerate? These are the current settings I am using.

1588006755337.png
1588007318481.png
 
The attributes are updated within the Update loop. If you set a Application.targetFrameRate then it should be consistent but I'll also change it so it's updated within FixedUpdate.
 
Hi Justin,

I know you are super busy. Just wanted to see if there was a way for me to update this myself? Where would I switch it to Fixed Update? I'm planning on releasing my game soon, and this was one of the last items on my list to fix before launch.

Thanks!
 
I just made the change but you'll want to open the AttributeManager and change Scheduler.Schedule to Scheduler.ScheduleFixed for the AutioUpdateEvent assignments on lines 121 and 128.
 
Top