PopcornFX v2.18

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.18
  4. Plugins
  5. Unity Plugin
  6. Managers and Static functions

Managers and Static 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 typeDescription
voidProfilerEnable(bool onOff)
Used to start or stop the PopcornFX native profiling.
voidProfilerWriteReport(string path)
Writes the latest PopcornFX profiling data on disk.
voidResetAllEffects()
Kill all existing effects. This can be used when changing scenes if you don’t want lingering effects from the previous scene.
voidResetAndUnloadAllEffects()
Same thing as ResetAllEffects() except that this also completly unload the effect assets from the PopcornFX runtime.

 

Property typeDescriptionDefault value
floatTimeMultiplier
Time multiplier applied to the particle update.
frameDt = Time.smoothDeltaTime * TimeMultiplier
1.0f
boolUseFixedDT
If true, uses Time.fixedDeltaTime instead of Time.smoothDeltaTime for particle update.
frameDt = Time.fixedDeltaTime * TimeMultiplier
false

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);
        }
    }
}
Was this article helpful to you? Yes No

How can we help?