Raycast End Layer bug

I discovered while testing the challenge that the CursorAffordance script was not changing the Cursor when going off the edge of the world. To fix this I changed the code at the end of the Update function in CameraRaycaster. Instead of just changing the layerHit to to Layer.RaycastEndStop every frame that the cursor is off the world, it would only change the frame that it went off and also called the delegates. This is the code that I did at the end of Update:

if (layerHit != Layer.RaycastEndStop)
{
	layerHit = Layer.RaycastEndStop;
	onLayerChange(layerHit); // call the delegates
}
1 Like

Hi Alistair,

You will discover in a later lecture in the section that this issue is discovered and a solution put in place, however well done for both noticing the issue and applying a fix yourself. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms