![]() |
Pixelpart 1.9.0
Unity Plugin
|
A Pixelpart effect that is rendered using a PixelpartEffect component in your scene can be modified at runtime with scripts. This can be used to dynamically change the effect and let it react to other objects in the scene.
Effect inputs are the primary technique to dynamically modify effect properties. The following example shows how the value of an effect input, which has been defined in the Pixelpart editor, can be changed from a script:
Depending on the data type, several set methods are available to change the value of effect inputs:
To retrieve the currently set input value, use the corresponding get methods:
Triggers are used to make effects react to events in your game. The following example shows how a trigger can be activated from a script using the ActivateTrigger method:
Use IsTriggerActivated to check if a trigger has already been activated.
In contrast to triggers, events are used to make the game react to something happening in the effect, for example to play an audio clip when an emitter starts producing particles. You can subscribe to EffectEvent to get notified when effect events occur: