All our packages on the Unity asset store can be found here: https://www.assetstore.unity3d.com/en/#!/publisher/8762?aid=1101lGAz&pubref=wiki
Our official thread on the Unity forums is here : http://forum.unity3d.com/threads/popcornfx-optimized-particle-effects-plugin.297938/
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.
Setup From A New PopcornFX Project
- Make sure you are using the right version of the editor.
The editor's version must match the PKFxRenderingPlugin component version.
- Create a new project and choose the 'Unity Project' template
Set your project to be located in <Unity project's path>/YourFxProjectName
- Make effects!
- See Unity Project Setup and Use Particle Effects
Unity Project Setup
Importing for the first time / updating a project with v3.0+
- You only have to import the plugin package in your project
Updating a project with v2.X
- Make sure to upgrade your PopcornFX editor to the latest version (1.13.3) that you can download here and update your source PopcornFX project.
- Start by removing the folders "Assets/PopcornFX", "Assets/Resources/PackFx/" and also make sure to remove the old DLLs in "Assets/Plugins/PK-UnityPlugin*" before opening your project.
- Open your project and import the .unitypackage.
- The plugin now requires to enable unsafe code. You can add a file that contains just "-unsafe" in your assets folder and name it "smcs.rsp" ( as explained here ) or just enable it in Unity's player settings.
- Select the PkFXSettings.asset in the assets (it should be created when PopcornFX starts) and click on "Set Pack Fx Path" and select your PopcornFX project (where the PopcornProject.pkproj is located).
- Re-import the effects by clicking on "All" next to "Reimport Pack" or select which effects to import by clicking on "Choose files" (still in the PKFxSettings). make sure all the effects that are used in your projects are imported correctly.
- Right click on the project explorer in Unity and select PopcornFX > Update PKFX references, it should update all your scenes and prefabs so that they use the new PopcornFX component (this will keep all your attribute values and asset references).
- Make sure everything works fine in the editor.
The way to set the attributes and the samplers has also changed a bit. You now have to go through the PKFxFX.SetAttributeSafe (takes the name of the attribute and its value, check if the attribute exist and clamp the value) or PKFxFX.SetAttributeUnsafe (takes the attribute ID that you can retrieve on the asset by calling PKFxFxAsset.AttributeIdFromName and the attribute value, no clamp or check is done so be careful using this).
For the samplers, it works pretty much the same as before, the new function to set those is "PKFxFX.SetSamplerSafe".
Import Your Effects
In PopcornFX/Resources/PKFxSettings :
- Set Source Path : Path of your Popcorn Project.
- Set Destination Path : Path where you want your Effects to be in Unity.
While Unity is open, It will automatically import and reimport effects located in the Pack Fx Path when they are updated.
- This is triggered when saving inside PopcornFX editor
- And also when updating your repository !
You can reimport manually :
- Inside PKFxSetting, 'Reimport Pack' allows you to Import the whole pack, or to choose what effects to import.
- By selecting one effect asset and clicking the 'Reimport' button
Use Particle Effects
- In your scene add the PKFxRenderingPlugin component to your camera.
- Add a PKFxFX component
- Either by creating a new GameObject
- Or by adding the component on an existing GameObject :
- Select a "PK Fx Fx Asset"
- Run, watch, enjoy.
Setup Particle Collisions
Identify Errors (Debugging)
Animate Effect Attributes
Animate Effect Attribute Samplers
Manage Effects' Assets Loading
Setup Sound Layers
Pass Custom Data to the Audio Samplers
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.
This category has only the following subcategory.
Pages in category "Unity V3"
The following 12 pages are in this category, out of 12 total.