Hi All, I've been watching Brackeys videos on how to build a turret defense game on YouTube and I've been trying to replicate it but for Mobile. I'm stuck on Episode 6 where if the space does not have a turret, pressing a mouse click would put down a turret. I've been trying to figure out how I can replace part of the code for touch input but can't figure it out. Can anyone help? See code below:
void OnMouseButtonDown()
{
if(turret != null)
{
Debug.Log("Can't build there! - TODO: Display on screen.");
return;
}
GameObject turretToBuild = BuildManager.instance.GetturretToBuild();
turret = (GameObject) Instantiate (turretToBuild, transform.position, transform.rotation);
}