use timeline in script unity code example
Example: unity timeline
The Unity Timeline is a feature that allows you to visually edit music, play animations, show/hide objects, control particles, etc. along the time axis. It is similar to the ability to add and edit music, video, subtitles, and direction to a track in video editing software