top of page

Animation Event Weaver

Manual

Version 1.0.0

Video Tutorial: https://youtu.be/W4BsdIJNQ24

How to Use
Open EventWeaver

On the Unity menu, select: Tools > Reamplyfied > Animation Event Weaver



Event Weaver editor window
Event Weaver editor window

Open Unity’s animation window and keep it visible. Select a GameObject with an Animator component and animation.



To show the available events, make sure the selected GameObject has a script with a public method and the EventWeaver attribute attached ([EventWeaver] or [EventWeaverExt]). For example, select “Object A” in the Inspector on the “EventWeaverExt Simple Example” scene.

 

EventWeaver Window

 

Adding event: Use the event buttons to add events on the current animation frame. Events can also be added from the “Add Event +” dropdown menu.



Remove event: Use the “Remove” button beside the event field to remove the event.



Copy and Paste event: Use the “Copy” or “Copy all” button to copy an event or all the events at the current frame. Then paste using the “Paste:” button at the current frame.



Track event: Use the “Track” button to track the time (in seconds) and any given event throughout the animation clip.


Creating an EventWeaver animation event

Creating an EventWeaver event:

  • Include the namespace “using Reamplyfied.AnimationEventWeaver;”

  • Then add [EventWeaver] or [EventWeaverExt] attribute at the top of your public method.


[EventWeaver]

[EventWeaver("Duration = 1")]
public void SlowMotion(float duration)
{
 	StartCoroutine(SlowMotionRoutine(0.3f, duration, 0.3f));
}

The [EventWeaver] attribute can be applied to your existing event without any changes to your code. It will provide the following benefits:


  • Adds a clear label to your parameter.


  • Adds a default prefilled value to your event.


  • Adds a shortcut button to the EventWeaver window.


[EventWeaverExt]

[EventWeaverExt("[-g/Bullet Properties]BulletDamage(int) = 1, BulletSpeed(float) = 5.5, [n/]CameraShake(bool) = true, " + "[=g/]BulletOrigin0ffset(vector3) = (1, -0.5, 0), BulletColor(Color), GunSound(enum:GunSound)")]
public void SpawnBulletExt(AnimationEvent evt)
{
}

The [EventWeaverExt] attribute requires an AnimationEvent parameter. It extends Unity’s AnimationEvent to support unlimited parameters, including: bool, enum, color picker, vector2, and vector3. Additional benefits include:


  • Adds a clear label to your parameter.


  • Adds a default prefilled value to your event.


  • Adds a shortcut button to the EventWeaver window.


  • Organise parameters horizontally or vertically.


  • Adds a grouping system to add related parameters to a group with a group title.

Tag

Tag

Description

Usage Example

(float)

Draw a float input field for the parameter

“Duration(float)”

(int)

Draw an int input field for the parameter

“Damage(int)”

(string)

Draw a string input field for the parameter

“AttackName(string)”

(obj)

Draw a Unity Object field for the parameter

“SpawnOBJ(obj)”

(bool)

Draw a bool toggle field for the parameter

“SlowMotion(bool)”

(vector2)

Draw a Vector2 input field for the parameter

“Dodge(vector2)”

(vector3)

Draw a Vector3 input field for the parameter

“Rotate(vector3)”

(color)

Draw a color picker for the parameter

“ProjectileColor(color)”

(enum:)

Draw an enum dropdown for the parameter

“Shake(enum:Shake)”

Note:

  • If no tag is added, a string field will be drawn. You can still use the float, int, or string getter to convert the data.


  • The (obj) tag can only be used once per method since the animation event provides only one object reference field. However, multiple objects can be called via script using a string ID or by assigning an enum.


  • When using [EventWeaver], only methods with AnimationEvent parameter can accept/requires tags, limited to only (float), (int), (string), and (obj).


Caution: Parameter name/label in the attribute also serves as a key for the set value/data. Modifying it after the event has already been used will ignore the old key; old data will not be used.

Avoid renaming a parameter after the event has been used in an animation clip, or else you will have to set the field again manually.


You can safely rearrange, add new, or remove parameters of an event.


Example: Changing

[EventWeaverExt(Delay(float) = 0.1, Duration(float) = 1)]

to

[EventWeaverExt(Duration(float) = 1, Delay(float) = 0.1)]

or

[EventWeaverExt(Duration(float) = 1, Time(int), Delay(float) = 0.1)]

Grouping Syntax

Syntax

Description

Usage Example

[n/]

Start parameter on a new row.

“Time(float), [n/]Level(int)”

[-g/]

Create a horizontal group

“[-g/]Time(float), Level(int)”

[-g/Group title]

Create a horizontal group with a title

“[-g/LevelUp]Time(float), Level(int)”

[=g/]

Create a vertical group

“[=g/]Time(float), Level(int)”

[=g/Group title]

Create a vertical group with a title

“[=g/NextLevel]Time(float), Level(int)”

[/n=g/]

Start the group on a new row

“[=g/NextLevel]Time(float), Level(int),” +

“[/n=g/]Play(bool), Index(int)”

 

Note: [EventWeaver] does not use grouping syntax

Getters

Type

Description

float

= EventWeaverRuntime.GetFloat(this, evt, "parameter");

int

= EventWeaverRuntime.GetInt(this, evt, "parameter");

string

= EventWeaverRuntime.GetString(this, evt, "parameter");

bool

= EventWeaverRuntime.GetBool(this, evt, "parameter");

Vector2

= EventWeaverRuntime.GetVector2(this, evt, "parameter");

Vector3

= EventWeaverRuntime.GetVector3(this, evt, "parameter");

Color

 = EventWeaverRuntime.GetColor(this, evt, "parameter", Color.white);

enum

 = EventWeaverRuntime.GetEnum(this, evt, "parameter", set your fallback enum);

Unity Objects

 = evt.objectReferenceParameter as [object type];

Where:

this = MonoBehaviour.

evt = AnimationEvent.

“parameter” = parameter name defined in the [EventWeaverExt] attribute.

 

Note: Getters are only used for [EventWeaverExt] attribute values. [EventWeaver] values are obtained directly from the parameter passed in the method (Unity's Get and Set).


Caution: The Parameter name in the getter function must be identical to the name defined in the [EventWeaverExt] attribute. An error message will be sent if the getter function cannot find the parameter or if the name is incorrect.

 

For practical understanding of how to use, please check out the example scenes and script included in the asset.


Do not hesitate to contact us for technical support.

Email: reamplyfied@gmail.com

bottom of page