Fix for Flickering cursor

Just a heads up - if you change the hotspot of the cursor you might get some flickering on the texture as it is changed inside Update(). To counter this, you can just do a private CursorType currentCursor field, set that to the type parameter at the end of SetCursor(). Then at the start of SetCursor() you check if the new type is same as currentCursor. If it is, do early return. This way it doesn’t set the hotspot every frame.

1 Like

That’s a very good tip!

Returning early when the type didn’t change should also be faster (granted, we don’t have that many cursor types, so the foreach() loop is quickly done, but this way we avoid looping altogether.

Of course, eventually this could be done in an event, but OTOH do we really want to pass around events for when the player moves the mouse, which would happen all the time during playing, anyway?

Privacy & Terms