Newly spawned units are not selected by default

At 14:44 you state that the unit will be automatically selected by default. This is not always the case. Depending on the exact size of the unit collider and where you click on the red cube spawner, its possible to click in a part of the cube that doesn’t overlap the new unit, therefore not triggering the selection.

This was more pronounced for me since I scaled the tank down to 50% size, but even in your video it seems possible to do this.

I was able to fix this by calling a TargetRpc method in the UnitSpawner that calls to the UnitSelectionHandler to select the newly spawned unit.

Just wanted to run this by you guys to see if this makes sense.

thx

Hi, I believe this issue disappears later in the course since we add a timer to the unit spawner. This way the unit isn’t spawned at the same time you click on the unit spawner. You are correct that this is a collider issue. You can move the spawn point and prevent the selection of the unit as well.

Privacy & Terms