|For PK-Fx Editor version : 1.7.3 and above
Main page: Particle tutorials
This Tutorial assumes that you have already installed Unity 4.6 and PopcornFX 1.7.3
Section 1: Install the Free Unity Project
- Goto http://www.popcornfx.com/download/
- Find in the Engine Intergrations section link to "PopcornFx-UnitySamples.zip" and download the link. Otherwise use the direct link provided here. https://www.popcornfx.com/downloads/updates/get.php?id=dn4AMxj6nPyrBgiZ
- Save the above zip file and extract it to your C: on your drive. The folder created should be "C:\Popcorn-Unity-Samples". The folder structure in the zip file contains a unity project.
- Open Unity 4.6
- Goto File/New Project
- Click the Open Project tab and then Click "Open Other" button
- Navigate to "C:\Popcorn-Unity-Samples" and click Select Folder Button
- Unity will Restart and compile the project folder we just selected
- By Default you will have the following folder structure. Open up "Assets/PopcornFX_Samples" to reveal the sample PopcornFX Unity Scene files and Double Click "Sample_Torchfire".
- Click the "Play" button at the top of the Unity UI (Cntrl-P is Shortcut for "Play").
- You will see a watermarked Game window playing the sample torchfire effect!
- Find the Hierarchy tab and Expand the "Root" gameobject all the way to reveal "FX". Click FX to reveal the Settings for the "PKFx FX" script. this script serves as the container for a PKFX file that was generated in PopcornFX, baked, then saved in this sample project. In this case the script points to Assets/StreamingAssets/PackFX/Particles/Torchfire.pkfx.
- You can click Stop/Start/Restart to test the effects spawning behavior
- Custom attributes can be setup in PopcornFX so you can control any scriptable behavior in Popcorn via Unity gamecode! Try playing with "FireEvolution" and note the effects behavior.
- Select the Main Camera in the Hierarchy section. Take note of all the paramenters to play with. Adjust them to see what happens!
Section 2: Setup PopcornFX to export to our Unity project folder
In order to author effects in popcorn and see them in Unity you must setup a Popcorn Project to run in parallel with the unity project.
- Create a new project
- Create a folder on C: next to our Unity project call it "Popcorn-Unity-Samples-PKFX".
- In the PopcornFX select "Popcorn-Unity-Samples-PKFX" in the project window, then click "Settings".
- Edit the settings :
General > Axis System > Axis_LeftHand_Y_Up
- Click Assets > Baking
- Type in "Unity" in the input field next to the "New" button then click "New".
- Navigate in windows to "C:/Popcorn-Unity-Samples/Assets/StreamingAssets/PackFx" and copy the path
- Input in newely created "Unity" text box "../Popcorn-Unity-Samples/Assets/StreamingAssets/PackFx" and click OK. *NOTE: Typically the path is formed like this. <Your Unity project's path>/Assets/StreamingAssets/PackFx
- Once the PopcornFX project launcher appears. Double click "Popcorn-Unity-Samples-PKFX" in the projects list.
- In windows navigate to "C:/Popcorn-Unity-Samples-PKFX".
- Make a folder named particles.
- Make a folder named textures.
- Make a default effect in "C:/Popcorn-Unity-Samples-PKFX/particles". Name it "PKFX_test" and open it in the ParticleEditor by double clicking the new icon..
- In the ParticlesTree window go to Editor Properties > Backdrop > 3D Layers (Scene) > Model.
- In the Node Properties Windows View go to General > ResourceModel and click the trash can to remove the reference to "Meshes/CubeRoom_Default.fbx" as it will be unecessary for the baking of the particle effect to Unity.
- In the ParticlesTree window go to Particle Effect > Spawner > Layer_1.
- In the Node Properties Windows View go to General > Infinite and check the box. This will insure that it will loop in Unity. Save and Close the Editor
- Right click on your new effect and select Bake with dependencies
- Open the Unity project again and make a new scene.
- Create a Gameobject and attach PKFxFX. The scripts are located in Assets > PopcornFX > Scripts > PKFx-Runtime.
- With your gameobject still selected go to the inspector Click the radial button next to the FX input field.
- Type in "PKFX_test" in the search field and click on your asset to target it in the "PKFx FX Script".
- Create a Camera and attach PKFxCamera. Same location as above script.
- Position your Camera to view the Gameobject you just created and Press Play.
- See your effect play.
- For the paid plugin see Unity Project Setup and Use Particle Effects for more info.
Unity Project Setup
- Import the plugin package (without StreamingAssets/PackFx if starting from a new PopcornFX project)