Category:Unity V3

From PopcornFX
Revision as of 15:10, 5 July 2018 by Vbas (talk | contribs)
Jump to navigation Jump to search

All our packages on the Unity asset store can be found here:!/publisher/8762?aid=1101lGAz&pubref=wiki
Our official thread on the Unity forums is here :
You can find the documentation for the version 2.X here : Unity


What's the PopcornFX Unity Plugin

The PopcornFX Unity plugin is an integration of the PopcornFX runtime libraries in the Unity game engine.
It takes advantage of Unity's Native Plugin Interface and Unity's command buffers.

The plugin actually refers to 2 distinct parts :

  • The native plugin: a C++ library that runs natively on each platform, libraries for each platform can be found in Assets/Plugins.
  • The managed plugin: a set of C# scripts that are not platform-specific and provide the interface between Unity and the native libraries. They're located in Assets/PopcornFX/Scripts/

These are both identified by their version numbers and can't be dissociated (you can't take the native part from the 3.0 plugin and use it with 3.1).
The Asset Store packages are identified with the managed version number only.

The managed scripts are provided with each version of the plugin (desktop, ios and android) and should be exactly the same (so once you've imported 3.0 from whatever package, you only strictly need the content of Assets/Plugins/ from the other packages).
All 3.0 packages have the same managed assemblies. Only the different platform-specific native libraries are exclusive to each package.

Getting Started

Setup From A New PopcornFX Project

  1. Make sure you are using the right version of the editor.
    The editor's version must match the PKFxRenderingPlugin component version.

  2. Create a new project and choose the 'Unity Project' template
    Set your project to be located in <Unity project's path>/YourFxProjectName

  3. Edit the settings :
    Baking > New platform > <Unity project's path>/Assets/Resources/PackFx
    UnityPKFxBakingSettings V3.png

  4. Make effects!

  5. Bake with dependencies

  6. See Unity Project Setup and Use Particle Effects

Unity Project Setup

If importing for the first time / updating from a v3.0+

  1. You only have to import the plugin package in your project

If importing from a project with v2.X

  1. Move your PackFx folder from Assets/StreamingAssets to Assets/Resources
  2. Delete all the 2.X plugin's files from your project
  3. Import the plugin package
  4. Update the components to the 3.0 version using the menu command Assets > PopcornFX > Update PKFxFX References (2.X to 3.X)

How To...

Use Particle Effects

  1. Have an FX pack baked in Assets/StreamingAssets/PackFx (see Setup from new PopcornFX project)
  2. In your scene add the PKFxRenderingPlugin component to your camera.
    UnityRenderingPluginAdd V3.gif
  3. Add a PKFxFX component
    • Either by creating a new GameObject
    UnityFXNew V3.gif
    • Or by adding the component on an existing GameObject :
    UnityFXAdd V3.gif
  4. Select a "PK Fx Fx Asset"
    UnityFXSelectAsset V3.gif
  5. Run, watch, enjoy.

Setup Particle Collisions

Setup Particle Collisions

Identify Errors (Debugging)

Identifying Errors

Animate Effect Attributes

Animating Effects Attributes

Animate Effect Attribute Samplers

Animating Effects Attribute Samplers

Manage Effects' Assets Loading

Managing FX Loading

Setup Sound Layers

Setting Up Sound Layers

Pass Custom Data to the Audio Samplers

Passing Custom Data to the Audio Samplers (Unity Plugin)

Components Reference


PKFx-Helper Assembly


PKFx-Runtime Assembly


PKFxManager Assembly

Plugin's Menus


Plugin's Memory Stats

Plugin RAM overhead without any effect loaded: ~10Mo.

Then the plugin memory consumption is tightly linked to the complexity of your effects (the number of fields per particle, the particle count and the number of layers in your effects).

On Android:

  • The plugin size is ~5.5Mo in the final .apk

On Windows x86:

  • The .dll size is ~4Mo + the shader compiler dlls which are ~5.5Mo

On Windows x64:

  • The .dll size is ~5Mo + the shader compiler dlls which are ~6.5Mo

On Linux x86:

  • The .so size is ~25Mo

On Linux x64:

  • The .so size is ~25.5Mo

On MacOS:

  • The .bundle size is ~16Mo



Feature list

Not all features allowed by the PopcornFX SDK are implemented in the Unity plugin.
To see the current status of the Unity integration, see the Feature list.