Forum rules - please read before posting.

gameState cutscene for timeline

Hello Chris,

is there a way to distinguish gameState cutscene when a timeline plays or when there is an active speech?

ac gamestate returns cutscene for both of them and I am trying to run an animation only on dialogues but not on timeline

thanks

Comments

  • edited August 2020

    If your Engine: Control Timeline Action has Wait until finish? checked, and at least one of the Timeline's tracks is bound to a character, then OnCharacterEnterTimeline and OnCharacterExitTimeline events will be triggered for that character at the beginning and end of the Timeline's playback.

    You should be able to use this to determine the difference, e.g.:

    using UnityEngine;
    using UnityEngine.Playables;
    using AC;
    
    public class TimelineChecker : MonoBehaviour
    {
    
        bool isInTimeline { get; private set; }
    
        void OnEnable ()
        {
            EventManager.OnCharacterEnterTimeline += OnCharacterEnterTimeline;
            EventManager.OnCharacterExitTimeline += OnCharacterExitTimeline;
        }
    
        void OnDisable ()
        {
            EventManager.OnCharacterEnterTimeline += OnCharacterEnterTimeline;
            EventManager.OnCharacterExitTimeline += OnCharacterExitTimeline;
        }
    
        void OnCharacterEnterTimeline (AC.Char character, PlayableDirector director, int trackIndex)
        {
            isInTimeline = true;
        }
    
        void OnCharacterExitTimeline (AC.Char character, PlayableDirector director, int trackIndex)
        {
            isInTimeline = false;
        }
    
    }
    
  • this doesnt work if I dont have a character on a track right?

    in that case should I put a dummy character on a track and leave it empty?

    thanks
  • Yes, that would be a good workaround for the above script.

    But if you know which Timeline you want to check for, you can instead just read the PlayableDirector component's state value:

    PlayableDirector myDirector;
    if (myDirector.state == PlayState.Playing)
    {
        //
    }
    
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.