Hello,
I’m hoping someone can help me out with a slight glitch I am having. Here is the problem. When I click on the unit spawner it doesn’t always spawn a unit. I’ve tested the following:
- moving the mouse between clicks gives me the infrequent spawning.
- not moving the mouse between clicks leads to nothing ever spawning.
- the location of the click (so long as its on the spawner box) has made no noticeable diffence. If a unit doesn’t spawn clicking Spot A, and a unit doesn’t spawn clicking Spot B, clicking Spot A again could spawn a unit.
- I have added three lines of debug code to the following spawner code.
public void OnPointerClick(PointerEventData eventData)
{
Debug.Log("Clicked");
if (eventData.button != PointerEventData.InputButton.Left) { return; }
Debug.Log("Clicked on a Spawner");
if (!hasAuthority) { return; }
Debug.Log("Clicked on my Spawner");
CmdSpawnUnit();
}
There is never a time where only one debug is written to console. If a unit spawns, all debugs are written to console. If a unit doesn’t spawn, nothing is written to console. This leads me to believe the issue isn’t with this code.
5. I thought maybe something “invisible” could be blocking the spawner, but I don’t see anything in the hierarchy or on screen that could be blocking it.
Any ideas would be very much appreciated. Thanks!