Hey guys I have an object that will open a level when clicked and will go into “delete/edit mode” if double clicked, problem is with ngui if I used OnDoubleClick() it seems to be called after the OnClick(), I’ve searched online and have failed at every solution google has to offer, any advice?

Here is the I made. I have tested it with a NGUI button.

In the inspector :

52291-doubleclick.png

using UnityEngine;
using System.Collections;

public class DoubleClick : MonoBehaviour
{
    public float delayBetween2Clicks ; // Change value in editor
    private float lastClickTime = 0 ;
    
    public void OnClickCallBack()
    {
        if( Time.time - lastClickTime  < delayBetween2Clicks )
        {
            Debug.Log( "Double clicked" );
        }
        else
        {    
            StartCoroutine( OnClickCoroutine() ) ;    
        }
        lastClickTime = Time.time ;
    }

    IEnumerator OnClickCoroutine()
    {    
        yield return new WaitForSeconds( delayBetween2Clicks ) ;
    
        if( Time.time - lastClickTime  < delayBetween2Clicks )
        {
            yield break ;
        }

        Debug.Log( "Simple click" );
    }

} // class DoubleClick