Handle Events with the Unity Plugin V3
Jump to navigation
Jump to search
![]() |
Contents |
You can register a custom handler to handle the events coming from PopcornFX into Unity.
You can access to the event name, and if you enable the unsafe code you can also access the position of the particle which emitted the event.
Example Code
The following example script demonstrates how to register the custom handler for the events.
public class HandlePopcornFXEvent : MonoBehaviour { void Start () { PKFxEventManager.RegisterCustomHandler(OnRaiseEvent); } #if PK_UNSAFE_CODE_ENABLED public static void OnRaiseEvent(string eventName, Vector3 position) { Debug.Log(eventName + " " + position); } #else public static void OnRaiseEvent(string eventName) { Debug.Log(eventName); } #endif }