- Home /
Legacy particle system doesn't work on Unity 4.0
Hello:
This is my first question and sadly it's more a complain.
I'm new in Unity and looking some tutorials i found a particle system used for explosions called Legacy, i have the 4.0 version and i don't see it like in the tutorials (probably because they use 3.5 and/or previous version) but the options is there and i tried it using an empty object and add it as a component (ellipsoid, animator and rendered), animate it like the tutorials but doesn't show any particle, just some purple squares, plus, when i add a material to the ellipsoid particle system (to the empty or a prefab) like the default particle material, it show the particle but in a black square. I tried looking at the script as well, but i'm kinda new on that too.
So, any help with that you can provide me?
What just happened here? Deademon accepted my answer on behalf of Unidesky and now it's deleted?
Answer by clunk47 · Sep 29, 2013 at 03:08 AM
Just to make it easier, create a folder called "Editor" in your assets folder. This is something I came up with because I was tired of always needing to add all the components to an empty gameObject one at a time, then assigning a material in the inspector. This will create a "Resources" folder, and a material asset for later use. All you need to do is click on the new menu item "Custom > Add > Legacy Particle System", then add a texture to the material (only need to assign texture to material once, unless you delete the asset). Create a new C-Sharp script in this new editor folder and name it after the class here "LegacyParticleSystem", then simply paste my code in the script, then save. You may need to save your scene before the new menu item appears on the top bar. Note the shader of the custom material created in the Resources folder is "Particles/Alpha Blended Premultiply".
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;
public class LegacyParticleSystem : MonoBehaviour
{
static Material mat;
[MenuItem("Custom/Add/Legacy Particle System")]
static void AddParticleSystem()
{
string matAsset = "Assets/Resources/Custom Assets/Legacy Particle Material.mat";
if(!Directory.Exists("Assets/Resources/Custom Assets"))
Directory.CreateDirectory("Assets/Resources/Custom Assets");
GameObject ps = new GameObject("Particles");
string[] coms = new string[]{"EllipsoidParticleEmitter", "ParticleRenderer", "ParticleAnimator"};
if(Selection.activeTransform != null)
ps.transform.position = Selection.activeTransform.position;
foreach(string com in coms)
ps.AddComponent(com);
if(!File.Exists(matAsset))
{
mat = new Material(Shader.Find ("Particles/Alpha Blended Premultiply"));
AssetDatabase.CreateAsset(mat, matAsset);
}
ps.renderer.sharedMaterial = (Material)AssetDatabase.LoadAssetAtPath(matAsset, typeof(Material));
}
}
Answer by Eric5h5 · Dec 17, 2012 at 05:49 AM
It works fine; you need a material with an appropriate texture and shader. Use one of the particle shaders.
"It works fine; you need a material with an appropriate texture and shader. Use one of the particle shaders."
Can you elaborate on this please? What would the steps be for a newbie to Unity 4.0 (or Unity in general) to create an object with the proper textures and shaders for the Legacy particle system? I've tried a few things and cannot get the Legacy stuff to work at all.
Answer by Owen-Reynolds · Dec 17, 2012 at 04:11 PM
There's a rule in making computer systems that if something is rare or experts only, you hide it a little so that beginners won't use it by mistake and get confused. The Legacy system works great, but new users had trouble with it, and Unity Answers wasn't helping (it seemed to be filling up with wrong info.) So, defacto, the Legacy system is "experts only" (but not really.)
When Unity3D Corp made the new shuriken particleSsytem, I'm guessing they decided to hide the old one by removing the GameObject version of it, and forcing you to build it from parts. They wanted to make sure no new users mistakenly grabbed the old version and got even more confused than before.
If you're an experienced user, you only have to build it once. Then you can make it a prefab for 1-step creation (or put in a package so you won't even have to build it for new Projects.)
The OP says how to get it: create an empty and add Effects->Legacy->ellipsiodEmitter, animator, renderer (all 3 in the same area.) Then you get purple squares. Then, as Eric5 writes, add a material to the renderer
Ok I got that far, but I cant seem to be able to make each particle a mesh.
Answer by DaveA · Dec 17, 2012 at 11:20 PM
If your goal is to make nice explosions, forget about 'legacy' and grab the Detonator Pack. That's great stuff, you'll be blowing stuff up in minutes.
Detonator pack is on the asset store?
For what i understand, i'm a newbie on Unity, so i should learn to use Shuriken first and only, then i can go to Legacy, right?
Yes, it's free too. Legacy is, in my opinion, easier to use, but you have to build the system up a bit. Shuriken is more flexible and powerful, I think more difficult, but it generally works better for most things.
If you've invested time in that tutorial, may as well keep at it, with the "Legacy" system.
An example of how "hard" it is: if you want a random speed from 5 to 9, you have to set the base speed to 7 and the random +/- to 2.
Answer by HappyMoo · Jan 16, 2014 at 07:04 AM
(Reposting answer - mod must have deleted by accident)
Unity 4 has a new particle system. The old still works though and also allows for more control with scripting. You can use the script discussed here to easily add them via menu:
http://answers.unity3d.com/questions/365337/legacy-particle-system-doesnt-work-on-unity-40.html