Managers and Statics functions
PKFxManager
The PKFxManager (PKFxManager.cs) is the singleton in charge of the interop between C# and C++.
It allow direct control of effects, attributes, samplers and general PopcornFX state.
Return type |
Description |
|
|
|
|
|
|
|
|
Property type |
Description |
Default value |
|
|
|
|
|
|
Code sample
Here is a simple code sample showing how to switch between a project scenes without lingering effects:
using UnityEngine;
using UnityEngine.SceneManagement;
public class ChangeLevelOnKeyPressed : MonoBehaviour
{
void Update()
{
// Switch to the next scene when pressing tabulation.
if (Input.GetKeyDown(KeyCode.Tab))
{
// This will kill all the existing particles in the current scene to avoid lingering effects in-between scenes.
PopcornFX.PKFxManager.ResetAllEffects();
// Now we can load another scene:
Scene scene = SceneManager.GetActiveScene();
SceneManager.LoadSceneAsync((scene.buildIndex + 1) % SceneManager.sceneCountInBuildSettings);
}
}
}