Repository navigation
Animations & Particles
Michel McBride-Charpentier edited this page Sep 29, 2020
·
5 revisions
See "Animation & Particles" example provided in the Unity Modding Project.
-
Set up your assets
- Create an
Animator Controllerasset (Assets > Create > Animator Controller), or duplicate the one in the example folder. - Create an
Animationasset (Assets > Create > Animation), and in the inspector checkLoop Time. This may also be referred to as anAnimation Clip.
- Create an
-
Set up the Animator Controller
- Open the Animator window (Window > Animation > Animator), and select your
Animator Controllerasset. - If you created a new Animator Controller asset: Right-click anywhere in the grid and select Create State > Empty. A transition from the Entry state will automatically be created.
- Select the New State object that was created (or Default State if you duplicated the example), and in the inspector add your
Animationasset to theMotionfield. - You can have multiple animations if you want. Just create new animation states connected to the Entry state (Right-click Entry > Make Transition and select your New State.)
- Open the Animator window (Window > Animation > Animator), and select your
-
Create The Animation
- See the Animation Window Guide in the Unity Manual.
- If you'd rather import an animation along with your mesh from your 3D software, you can do that too. Instead of creating a new
Animationasset, you use the one that is imported. See Animation From External Sources in the Unity Manual.
Resources
ℹ️ The most important thing to know is that, like in the example, Particle System game objects must be disabled in the hierarchy. This is because of some weirdness in setting them up in the game so they react correctly to game speed changes or pausing.
You can pretty much do whatever you want with particles. Play On Awake needs to be checked, and you'll probably also want Looping checked too.
It's possible to have non-looping particle effects triggered by an animation. The example in the Animations & Particles folder does this, where particles are created every time the drill hits the ground.
- The Particle System's
Stop Actionshould be set to None (otherwise it might only work the first time). - Add animation keys to turn the Particle System's
Is Activevalue on and off where needed. WithPlay On Awakechecked, it'll fire each timeIs Activeis set to On.
Getting Started
How To
Game Items
Assets & Best Practices