How to display advice to the user when idle for more than 5 seconds in the unit?


I have made a 2D Game using unity in which user has to select objects of similar color and now i want to display hint when user is unable to select the color for more than four seconds.

I want something similar to candy crush hint displaying system in which candy crush shows hint by highlighting the possible combination if user is not able to identify any combination himself.

I cannot figure out how to find if the user is inactive so that i can display hints.

I would really appreciate if someone can help me in figuring it out. Thanks in advance.

I dont agree with Joe Blow on this one that you need to call that EVERYWHERE in your code the user does something. What a user can do is press a key on the keyboard(also count on gamepads and controllers) or move the mouse(on mobile the mouse is simulated so that works too). So if you have a single class that looks something like this :

using UnityEngine;
public class TestInActive : MonoBehaviour {
    private Vector3 prevMousePosition =;
    void ShowGameHintInvoke()
        Invoke("GameHint", 5);
    void GameHint()
        Debug.Log("This is a Hint");
    // Update is called once per frame
    void Update () {
        if (Input.anyKeyDown || Input.mousePosition != prevMousePosition)
        prevMousePosition = Input.mousePosition;

It should work just fine. This calls ShowGameHintInvoke() once after the user has been inactive for 5 secs. Then it will not call it again until the user does something.