GameObjects missing from compiled game

A number of GameObjects are missing from the compiled version of my game. They are there in the editor, and they are there when I run the game from the editor. They seem to be GameObjects that were added in the last few weeks - all the earlier ones are present.

I get the game to list all the GameObjects in the scene using:

foreach (GameObject go in Resources.FindObjectsOfTypeAll<GameObject>())

The GameObjects are listed when it’s run from the editor, but a number are missing when run from a windows executable.

Does anyone have any idea why this might be or where I should start looking?

Ah, so somehow I’ve fixed it. I tried a number of things - created a new scene, rename objects, created new objects. Nothing seemed to work.

But then I removed every Unity thing from the project folder - all folders and files - except the scene and Assets folder and loaded it into unity again. I then had to reload the Post Processing package, removed some default packages that I don’t want and completed the post processing volume and layer parameters. It then worked. But I’m at a loss to why.

tldr; I made it work but not sure just what I did :-/