Turning on the selection box is blocking clicks to the Unit Spawner

After completing the “Selecting Multiple Units” lecture I was no longer able to click on the unit spawner to spawn units. I narrowed the problem down to the Start Selection Area function and found that commenting out the line unitSelectionArea.gameObject.SetActive(true); allowed me to start clicking on the unit spawner again. It seems that turning on the drag box happens every time I click, and it prevents the unitSpawner from receiving any clicks. Any ideas on what might need to change? To double check, I copy/pasted the code for the UnitSelectionHandler.cs file from github and ran that, and the problem persisted. Is there maybe a setting on the object or the canvas that needs to change to allows clicks?

2 Likes

I found my own soluction. This isn’t called out in the lecture that I can find, but the Drag Box is added around the 4:45 mark, and I can see in the editor that the “Raycast Target” option is selected and it never seems to be turned off.

For me, turning off the “Raycast Target” option on the Drag Box allowed my clicks to go through and trigger the Unit Spawner.

4 Likes

Ha, I just found the other topic already talking about this here -Glitch with spawning

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms