0 like 0 dislike

I managed to find a nifty time multiplier attribute in the PkFx Rendering Plug-in for unity; which essentially acts to speed up or slow down the particle effects in the scene in entirety. The programmers are trying to hook this up to a slider in order to speed up and slow down the particle effects at runtime, but are finding the script to be somewhat unstable as it breaks often. We're exposing the variable by going through the Rendering Plug-in itself in the code instead of adjusting the variable itself directly (like you could with something like color/opacity); simply because we don't know what that variable is or if it can be exposed as an attribute from the pkfx editor.

However, the coding the programmers set up for unity works, but it breaks whenever someone reopens the scene to the point where everything has to be re-hooked up again (which is obviously a bug). If anyone has any experience with this or any ideas about the Time Multiplier attribute it would be much appreciated.

1 Answer

1 like 0 dislike
Best answer


If what you are trying is to change the time multiplier for all the effects in your scene, this should be easy to do with a simple Unity script by just getting the "PKFxRenderingPlugin" component from your camera and access the "m_TimeMultiplier" public variable:

GameObject camera = GameObject.Find("PKFxCamera");
camera.GetComponent<PKFxRenderingPlugin>().m_TimeMultiplier = 2.0f;

And you also have a slider in the Unity editor if you check the "Show Advanced Settings" option on your camera, so you can see this slider changing at runtime if you modify it from a script:

But I guess that's what you are already doing.

If you are trying to change the time multiplier per effect, there is currently no way of doing that.

Concerning the bug you are experiencing, could you describe it with a little bit more details? What do you mean by "everything has to be re-hooked up again"?

Also if you think this bug could be caused by a recent plugin update, you can try the "safe way" to update:


Hope this helps

by Paul (7.9k points)
By hooking up, I mean that the script has to be re-added to the scene and all it's exposed variables have to be reassigned to the scene's objects. Mainly so that the scene's main camera has to be plugged back into the script so it may access PKFXrenderingPlugin. Otherwise the script won't function as intended.
It seems like your bug is not due to the PopcornFx plugin but to your script or your scene that could be corrupted.

Here is a script I have just tried and I can instantiate it in a scene, hook the PkFxRenderingPlugin to the pkFxCamera public variable, save the scene and then load the scene with everything still hooked up properly:

public class testScript : MonoBehaviour
    public PKFxRenderingPlugin pkFxCamera;

    // Update is called once per frame
    void Update ()
        pkFxCamera.m_TimeMultiplier = 2.0f;

If you could send us your script to support@popcornfx.com, maybe we could tell you where this bug comes from.