Raycast colliding with an object that no longer exists!

Hi, having some issues with a raycast. In my game I have 3 objects placed on top of each other (but not actually touching) as illustrated below:

[A]

```c
**In my code, I’m destroying object **. In order for object [A] to fall the necessary amount, I tell it to draw a ray down so in theory, the ray would hit object [C], calculate the distance and off it goes and I’ll move it to that position.

The odd issue I’m having is that after I’ve deleted object ** - and I’ve checked it no longer exists in the game hierarchy - I then tell [A] to cast a ray, but it is telling me that it’s actually hitting object ** - the object I just deleted. I can’t fathom why it still thinks object B exists. I’m doing the deletion of the object and the ray in the same frame, could this be an issue? Thanks for any help!**
```

Exactly ;). Destroy is ALWAYS delayed until the end of the current frame. You might want to use a coroutine for that. Just wait at least one frame so object B is gone for sure.

Another way could be to set the layer of object B to the IgnoreRaycast layer just before you delete the object.