-
-
Save HectorPulido/b9ea1ea9e65f7c1740dd4c42f7802e6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
public class buttontest : MonoBehaviour { | |
// Use this for initialization | |
void Start() | |
{ | |
EventTrigger trigger = GetComponent<EventTrigger>(); | |
EventTrigger.Entry PointerClick = new EventTrigger.Entry(); | |
PointerClick.eventID = EventTriggerType.PointerDown; | |
PointerClick.callback.AddListener((data) => { count = 0; clicking = true; }); | |
trigger.triggers.Add(PointerClick); | |
EventTrigger.Entry PointerUp = new EventTrigger.Entry(); | |
PointerUp.eventID = EventTriggerType.PointerUp; | |
PointerUp.callback.AddListener((data) => { | |
print(count); | |
if (count > 3 && count <= 6) | |
{ | |
print("EjecutarAccion1"); | |
} | |
else if (count > 6) | |
{ | |
print("Ejecutaraccion2"); | |
} | |
clicking = false; | |
count = 0; | |
}); | |
trigger.triggers.Add(PointerUp); | |
} | |
bool clicking; | |
float count; | |
private void Update() | |
{ | |
if (clicking) | |
{ | |
count += Time.deltaTime; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment