Skip to content

extension Unity3D timeline signal. 对Unity Timeline的Signal进行扩展,支持使用Evaluate来手动播放触发Signal,无需添加SignalAsset。支持无MonoBehaviour的Signal,支持倒播触发Signal。

Notifications You must be signed in to change notification settings

821869798/ExTimelineSignal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExTimelineSignal

中文 (Chinese)

Extension for Unity Timeline Signals, supporting manual Evaluate triggering, reverse playback, and pure C# signal logic without MonoBehaviour.

Features

  • Evaluate Support: Signals can be triggered even when manually evaluating the Timeline (not just during playback).
  • Reverse Playback: Supports triggering signals when the timeline is played in reverse.
  • Pure C# Logic: Supports ISignalExecutable interface for logic that doesn't need to inherit from MonoBehaviour (Executable Mode).
  • No SignalAsset Required: Simplifies workflow by removing the need for SignalAsset.
  • Binding Support: Easy binding to MonoBehaviour events using Signal Names.

Usage

1. Executable Mode (Pure Logic)

This mode allows you to execute custom C# logic directly from the Timeline without needing a MonoBehaviour receiver for every signal.

  1. Create an ExSignalExecutableTrack in your Timeline.
  2. Add an ExSignal Executable Emitter to the track.
  3. In the Inspector of the Emitter, you can add one or more scripts that implement ISignalExecutable.

Example ISignalExecutable:

using UnityEngine;
using UnityEngine.Playables;
using Unifan.ExTimelineSignal;
using System;

[Serializable]
public class MyCustomSignal : ISignalExecutable
{
    public void Execute(PlayableDirector director, ExSignalEmitter emitter)
    {
        Debug.Log($"Signal triggered at time: {emitter.time}");
    }
}

2. Binding Mode (Scene Interaction)

This mode is similar to the standard Signal Receiver but uses string-based keys (Marker Name) to bind actions, which is more flexible.

  1. Create an ExSignalBindingTrack in your Timeline.
  2. Add an ExSignal Emitter (the base emitter) to the track.
  3. Name the Emitter (e.g., "AttackStart"). This name is the Key.
  4. On the GameObject with the PlayableDirector, add the ExSignalReceiverBinding component.
  5. Bind the track to the GameObject (same object).
  6. In your code, register the action:
using UnityEngine;
using Unifan.ExTimelineSignal;

public class MyCharacter : MonoBehaviour
{
    void Start()
    {
        var receiver = GetComponent<ExSignalReceiverBinding>();
        // Bind the action to the signal named "AttackStart"
        receiver.RegisterAction("AttackStart", OnAttackSignal);
    }

    void OnAttackSignal(ExSignalReceiverBinding receiver, ExSignalEmitter emitter)
    {
        Debug.Log("Attack Started!");
    }
}

About

extension Unity3D timeline signal. 对Unity Timeline的Signal进行扩展,支持使用Evaluate来手动播放触发Signal,无需添加SignalAsset。支持无MonoBehaviour的Signal,支持倒播触发Signal。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages