using System.Collections; using System.Collections.Generic; using UnityEngine; namespace DSM { public class DSMRuntime : MonoBehaviour { bool DSMState = false; int limitTouches = 100; int currentToushes = 0; [SerializeField] GameObject DSMObject; private void Awake() { DontDestroyOnLoad(gameObject); } void Update() { if(Input.touchCount > 3) { if (Input.touchCount == 4) { currentToushes++; if (currentToushes >= limitTouches) ChangeState(); return; } } #if UNITY_EDITOR if (Input.GetMouseButton(1)) { DSMObject.SetActive(true); return; } else if (Input.GetMouseButton(2)) { DSMObject.SetActive(false); } #endif } void ChangeState() { DSMState = !DSMState; DSMObject.SetActive(DSMState); currentToushes = 0; } } }