If u have trouble with unit spawing in unity 2022, try this code:
public void OnMouseDown()
{
if (!Mouse.current.leftButton.wasPressedThisFrame) return;
if (EventSystem.current.IsPointerOverGameObject()) { return; }
if (!hasAuthority) { return; }
CmdSpawnUnit(unitSpawnPoint.position);
}
This worked for me, hope it work for you