I added another bool and put the timerlogic in a function of its own.
On mouse click the bool is turned true and wil InvokeRepeat the TimerLogic. When you want the timer to stop you have to put bool"X" to false.
using UnityEngine;
using System.Collections;
public class Timer : MonoBehaviour {
bool isWithdrawing;
bool X = false;
float WithdrawTimer;
public GUIText timerText;
// Use this for initialization
void Start () {
}
void TimerLogic(){
isWithdrawing = true;
WithdrawTimer += Time.deltaTime;
}
// Update is called once per frame
void Update () {
timerText.text = WithdrawTimer.ToString ();
if (Input.GetKeyDown (KeyCode.Mouse0))
{
X= true;
}
if (X == true) {
InvokeRepeating("TimerLogic",0.1f,60.0f);
}
else
{
CancelInvoke("TimerLogic")
}
}
}