Bumped into an issue I’ve never seen before. As I’m using the line gemRaysObj = GameObject.FindWithTag("GemRays");the script finds the object, but adds in parentheses “(Preview Scene)” after the name. If I click on the supposed referenced file in the inspector, it doesn’t appear in the scene hierarchy. Any thoughts on what might be going on?
I’ve also been running in to this. Restarting Unity definitely helped but I’d really like to know what’s causing it as packing arrays with gameobjects for later reference, based on the array’s length is something I do all the time and this breaks the array length when finding all gameobjects with a tag. It seems as though gameobjects are not being fully destroyed in the editor when entering and exiting play mode.
First of all, using GameObject.FindWithTag("ExampleGameObject"); is something I and most people don’t use. (it may seem simple but doesn’t seem to work now.)
What’s recommended is to use public GameObject ExampleGameObject;.
And then to call a function on the gameobject useExampleGameObject.MyFunctionGoesHere;
I would suggest parenting if you’re working with multiple gameobjects and define the parent in the inspector to be called with your function.
I had the same issue and some of my scripts where not working as expected at the same time. I restarted Unity and the preview scene was gone and my scripts started working again. Try restarting Unity.