├── .github └── FUNDING.yml ├── Assets ├── ButtonEvents.meta ├── ButtonEvents │ ├── ButtonDoubleClickListener.cs │ ├── ButtonDoubleClickListener.cs.meta │ ├── ButtonLongPressListener.cs │ └── ButtonLongPressListener.cs.meta ├── Demo.cs ├── Demo.cs.meta ├── Toast UI.meta ├── Toast UI │ ├── Resources.meta │ ├── Resources │ │ ├── ToastUI.prefab │ │ └── ToastUI.prefab.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── Toast.cs │ │ ├── Toast.cs.meta │ │ ├── ToastUI.cs │ │ └── ToastUI.cs.meta │ ├── Sprites.meta │ └── Sprites │ │ ├── square_r.png │ │ └── square_r.png.meta ├── scene.unity └── scene.unity.meta ├── ButtonEvents.unitypackage ├── LICENSE.MD └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://paypal.me/hamzaherbou'] 2 | -------------------------------------------------------------------------------- /Assets/ButtonEvents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce83bb33a8b85954fbdea65b6d3c579a 3 | folderAsset: yes 4 | timeCreated: 1626798039 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ButtonEvents/ButtonDoubleClickListener.cs: -------------------------------------------------------------------------------- 1 | /*-------------------------------------- 2 | Email : hamza95herbou@gmail.com 3 | Github : https://github.com/herbou 4 | ----------------------------------------*/ 5 | 6 | using System; 7 | using UnityEngine; 8 | using UnityEngine.Events; 9 | using UnityEngine.EventSystems; 10 | using UnityEngine.UI ; 11 | 12 | [RequireComponent (typeof(Button))] 13 | public class ButtonDoubleClickListener : MonoBehaviour,IPointerClickHandler { 14 | 15 | [Tooltip ("Duration between 2 clicks in seconds")] 16 | [Range (0.01f, 0.5f)] public float doubleClickDuration = 0.4f ; 17 | public UnityEvent onDoubleClick ; 18 | 19 | private byte clicks = 0; 20 | private DateTime firstClickTime; 21 | 22 | private Button button; 23 | 24 | 25 | 26 | private void Awake () { 27 | button = GetComponent