[SOLVED]Creating partical systems on collision

i am really new to unity, and i thought that this would be easy, but… what can i say, am not as smart as i thought i was lol
i am trying to create a particle system when a collision happens, so i made a prefab that has the particle system, (i called it ParticleSystem), and used the following code:

function OnCollisionEnter() {
	var go : GameObject = Instantiate(Resources.Load("ParticleSystem"));
}

but i got the error:

from what i understand from the error, i don’t have a prefab called “ParticleSystem” or that my prefab is empty. And the problem is that neither of those are true… so, any thoughts?

thnx

Any reason you’re using Resources.Load? Normally you’d do it like this:

var collisionParticles : GameObject;

function OnCollisionEnter() {
	var go : GameObject = Instantiate(collisionParticles);
}

–Eric

Take a look at
http://forum.unity3d.com/viewtopic.php?t=28433&postdays=0&postorder=asc&start=0
for the excellent beginners tuts. This will help you write a small but complete space shooter game covers the particle creation you require plus collision and basic movement etc.
Can’t recommend it enough for anyone new to Unity.

i am just using it, because that is how i thought it is done… i saw it somewhere on the forums lol

Nope, normally you only use Resources.Load in specific cases. Generally public variables are simpler and more flexible.

–Eric

thanks a lot for the tutorial, i am checking it out now… it seems very helpful

yup… it works fine now, thanks