Forum rules - please read before posting.

Double Tap To Skip?

I'm currently porting my FMV game to Android and am wondering how I can detect when a user double-taps or perhaps touches the screen with 2 fingers in order to skip a playing video?

I did this before but for the life of me can't remember or find out how.

I've got it set to Touch Screen and it all works absolutely fine - all menus work when open and I can bring up the pause menu by pressing the Android's back key. I just can't figure out how to register when a double-tap or 2 finger tap has been made in order to skip a video.

Can this be achieved with the Input Manager?

Comments

  • Unity's Input Manager doesn't allow for automatic double-click registering, no - you have to detect it manually via script.

    Try this:

    using UnityEngine;
    using AC;
    
    public class DoubleClickSkipMovie : MonoBehaviour
    {
    
        public string inputName = "SkipMovie";
    
        void Update ()
        {
            if (KickStarter.playerInput.LastClickWasDouble ())
            {
                KickStarter.playerInput.SimulateInput (SimulateInputType.Button, "SkipMovie", 1f);
            }
        }
    }
    

    Attach as a component in your scene, and set the Action's "Skip with Input Button" to match that of the component's Inspector ("SkipMovie" by default). Don't assign this in the Input Manager - instead, the script will simulate it when it detects a double-click/tap.

  • Thanks Chris.

    I've tried attached the script to the Videoplayer and also tried attaching it to an empty gameobject.

    It works to an extent and skips, but if there are queued videos, it sometimes skips those too instead of automatically skipping to the next video in line in the actionlist. Any ideas as to why it's doing this?

  • edited March 2021

    UPDATE: I've realised that it's easier to assign a mouse 1 key in the Input Manager under Skip so the player can simply simulate a right-mouse click by tapping simultaneously with 2 fingers and it works perfectly. Thanks for your time though Chris, much appreciated as always!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.