AnyPortrait > Scripting > Timeline

Timeline

The following are the functions to work with Unity's Timeline function.

These functions are available in AnyPortrait version 1.1.6.

For more information on how to work with the timeline, see the related page.

public bool AddTimelineTrack(UnityEngine.Playables.PlayableDirector playableDirector,

                                         string trackName,

                                         int layer,

                                         apAnimPlayUnit.BLEND_METHOD blendMethod)

​Description

To link the timeline, register the name of "Playable Director" and the track as "Track Data".

You can register two or more Playable Director or tracks.

When multiple tracks are registered for a common Playable Director, they are processed in the same way as multi-layer animation.

At this time, you can input the order of layers and blending method as arguments.

If you register different Playable Directors, it will only be controlled by one of the Playable Director currently playing.

Parameters

UnityEngine.Playables.PlayableDirector playableDirector : Playable Director you want to register

string trackName : The name of the track to be associated with the timeline of the Playable Director.

int layer : The order of layers when playing in multiple layers (default is 0)

apAnimPlayUnit.BLEND_METHOD blendMethod : The blend method when played in multiple layers (default is BLEND_METHOD.Additive)

Return

bool : Returns true if the Playable Director exists and the name of the track is valid; false otherwise.

public void RemoveInvalidTimelineTracks()

​Description

Remove all track data that is not currently valid.

This is the case when Playable Director, Timeline Asset, or Track can not be linked for reasons such as not being present in the scene.

public void RemoveAllTimelineTracks()

​Description

Remove all registered track data.

public void UnlinkTimelinePlayableDirector(UnityEngine.Playables.PlayableDirector playableDirector)

​Description

Removes all track data associated with the entered Playable Director.

Parameters

UnityEngine.Playables.PlayableDirector playableDirector : Playable Director of the track you want to remove

public void SetTimelineEnable(bool isEnabled)

​Description

Set whether animations are played by the timeline.

If true, the animation will play according to the Playable Director, but if it is false, it will not be controlled by the Playable Director.

Parameters

bool isEnabled : Whether to play by the timeline