void Interact() { RaycastHit hitInfo; if (Physics.Raycast(fpsCamera.transform.position, fpsCamera.transform.forward, out hitInfo, range)) { //This is where we'll check if it's a hittable game object that can take damage. if (hitInfo.transform.name == "BuildTile") { BuildMenu tile = hitInfo.transform.GetComponent <BuildMenu>(); GameObject hitObj = hitInfo.transform.gameObject; tile.Menu(hitObj); } if (hitInfo.transform.name == "RegTurret(Clone)" || hitInfo.transform.name == "AirTurret(Clone)") { BuildMenu tile = hitInfo.transform.GetComponent <BuildMenu>(); GameObject hitObj = hitInfo.transform.gameObject; tile.Upgrade(hitObj); } if (hitInfo.transform.name == "SlowTurret(Clone)") { BuildMenu tile = hitInfo.transform.GetComponent <BuildMenu>(); GameObject hitObj = hitInfo.transform.gameObject; tile.UpgradeSlow(hitObj); } } }