Mouse Tracking Issue

A simple fix for the Unity 5 raycasting issue

👍

Reminder - Keep Daily Backups!

When working on a strategy game with a kit as big as the Complete Kit - always keep a working daily backup! Save yourself the trouble of rolling-back changes and losing work.

You may notice when testing in the Unity Editor that when playing a building your mouse and the building may be offset by a large amount. (Although not seen in the screenshot below, imagine the mouse is located in the bottom left but the building the same movement is tracking in the top right)

461

Mouse offset

This is related to the raycasting building issue too - some building effects appear off, like in the below image. This is an issue with Unity 5 raycasting and occurs when testing inside the Unity editor - not in the gameplay.

450

When the game is run in editor something is off (and this accounts for a mouse raycast offset too when testing in the Unity editor).

How to fix

Everything goes back to normal if you resize the window a bit (make sure you don't have maximize on play enabled). Just drag the corner a few pixels and let go. The raycasting issue will fix itself instantly.

997

Click to view larger.