[SOLVED]Particle help

Sorry if this is in the wrong section.

Anyways,

So I just completed the Roll-A-Ball tut.
Now I’m trying to add particle effects on the pickups.

The problem is… I cant get anything to work. I’ve tried looking this up but I can’t find anything that works?..

Heres my code which is suppose to activate it every time the player collides, however this isn’t giving me any results…

using UnityEngine;
using System.Collections;

public class ParticleEmitter : MonoBehaviour
{
    public ParticleSystem exp;

    void OnTriggerEnter (Collider col)
    {
        if (col.gameObject.CompareTag ("Player"))
        {
            Debug.Log (" I should be emitting paritcles");
            Explode ();
        }
    }

    void Explode()
    {
        exp = GetComponent<ParticleSystem> ();
        exp.Play ();

    }
}

Warning: [quote]
The referenced script on this Behaviour (Game Object ‘Pickup’) is missing!
[/quote]

I have a particle system on ever pickup. I tried making it so it spawns the particle effect on that pick up with instantiate, however that wouldn’t work either.
I even tried making the particles massive just in case it was too small. And yes, I’ve hit “Apply” every time I put something on one of the pickups. The pickups are all under 1 prefab, just as in the tut.

Can someone please help me? This is very frustrating, I feel like it’s a lot easier than what I’m making it out to be

Is there a ParticleSystem on the same GameObject as ParticleEmitter?

Here’s a basic instantiate script that works:

public GameObject _particlePrefab;

void OnTriggerEnter(Collider collider)
{
    if (collider.tag != "Player") return;
       
    Instantiate(_particlePrefab, transform.position, Quaternion.identity);
}

Hmm still not working… It’s spawning them, but the particles aren’t appearing?..
Here’s the updated code that is attached to the pickups:

using UnityEngine;
using System.Collections;

public class Particles : MonoBehaviour
{
    public GameObject deathParticles;

    void OnTriggerEnter(Collider col)
    {
        if (col.tag != "Player")
            {
                return;
            }

        Instantiate (deathParticles, transform.position, Quaternion.identity);
    }





}

See attachments below for a picture of unity…

2644995--186304--ParticleError.png

Do you have Play On Awake ticked in the ParticleSystem?

1 Like

I’m 99% sure I don’t. (At work right now).

Is it suppose to be ticked for cases like this?

That worked!

1 Like