Raycast not hitting instantiated object when timescale is 0

My raycasting has 3 possible hits - UI, empty space or some game object that I spawn.

The game begins with timescale as 0 since it requires the user to select some configuration which then spawns the objects. At this step after spawning objects but before resuming timescale 1 my raycast doesn’t work on those spawned objects. I checked in the editor and they are there and the correct scripts are attached for correct detection. The raycast is still able to detect UI and empty space hits, but not object hits.

After I click my built in play button, which sets timescale to 1, the raycasting works fine.

I use Physics.Raycast to cast a ray on the objects.

I have the same issue and fixed it by checking the “Auto Sync Transform” in Project Setting >> Physics.
I think the problem is when you set timeScale to 0, the collider is not updated to its transform.

You’re probably raycasting in FixedUpdate(), FixedUpdate() does not run during Timescale 0. Move your raycast to Update().