Guest User

Untitled

a guest
May 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. /// <summary>
  6. /// 二重起動を防止する
  7. /// </summary>
  8. public class AvoidDoubleLaunch : MonoBehaviour
  9. {
  10. void Start()
  11. {
  12. string processName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
  13.  
  14. if (System.Diagnostics.Process.GetProcessesByName(processName).GetUpperBound(0) > 0)
  15. {
  16. Debug.Log("同じアプリがすでに起動しています.");
  17. Application.Quit();
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment