Raycasting 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 Unity that 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. There's quite an easy way to fix this - simple pull a corner of the Unity game preview to resize the game preview. The raycasting issue in Unity instantly corrects itself.

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.

❗️

Having problems?

Make sure you resize the game preview window, not the entire Unity editor window such as the corner of the application. The raycasting issue is inside the game preview, that's why you need to expand or resize that particular window like the screenshot above shows.

It also helps to drag the panel out of Unity into it's own screen. That's what we did in the example image above. Also try resizing bigger, a second time, if the first time you try it doesn't automatically fix the raycasting issue.