I’m trying to get the Game objects of a certain tag in my custom editor popup, so using the example provided, I paste: var respawns = GameObject.FindGameObjectsWithTag (“Respawn”); but I get the following error: “UnityException: You are not allowed to call this function when declaring a variable.
Move it to the line after without a variable declaration.
If you are using C# don’t use this function in the constructor or field initializers, Instead move initialization to the Awake or Start function.”
I tried backing up (copying the code), deleting the script and recreating it as suggested in this pos: Error message : You are not allowed to call this function when declaring a variable. - Questions & Answers - Unity Discussions but the solution does not work for me.
Any ideas?