CancelInvoke
How do I use Cancel Invoke
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
36 | this.CancelInvoke(); | 1 |
65 | CancelInvoke ("TimeChange"); | 2 |
File name: SupportLogger.cs
Copy
34 public void OnApplicationQuit()
35 {
36 this.CancelInvoke();
37 }
File name: TimerScript.cs
Copy
53 public void InitTimer() {
54 //set time remaining if it doesn't exist yet
55 if (!PlayerPrefs.HasKey ("timer_time_remaining")){
56 this.timeRemaining = PlayerPrefs.GetInt("options_timer_duration");
57 PlayerPrefs.SetInt ("timer_time_remaining", this.timeRemaining);
58 }
59 else {
60 this.timeRemaining = PlayerPrefs.GetInt ("timer_time_remaining");
61 }
62 PlayerPrefs.Save ();
63
64
65 CancelInvoke ("TimeChange");
66 if (PlayerPrefs.GetInt ("options_timer_duration") > 0) {
67 this.timerEnabled = true;
68 InvokeRepeating ("TimeChange", 1, 1);
69 }
70 else {
71 this.timerEnabled = false;
72 }
73 }
CancelInvoke 163 lượt xem
Gõ tìm kiếm nhanh...