Cursor Flicker and FPS Bug Fix

The cursor drops the FPS by about 40% and that is because we are setting the cursor on every update. This is also what is creating the cursor flicker. The fix for this is actually quite simple.

First, add an instance variable at the top of the class.

private CursorMapping _cachedCursorMapping;

Next, modify the SetCursor method

if(_cachedCursorMapping.Type == type) return;
_cachedCursorMapping = GetCursorMapping(type);

This fix makes my fps go from around 100 to about 190.

I believe that this fix also fixes this old issue.


That’s a good tip!

Thanks Brandon! This is great optimization for the cursor.

Glad to help!

Thanks for the tip!!

@Brandon_Anderson — Once again, another excellent optimization. Thanks!

Privacy & Terms