Particles enabled/disabled OnTrigger- not working. What have I done?

Can’t understand why this won’t work?
Any ideas?

#pragma strict


function OnTriggerEnter(trigger : Collider) {
     if(trigger.gameObject.tag == "Water"){
         GetComponent.<ParticleEmitter>().enabled = true;

     }
}
function OnTriggerExit(trigger : Collider) {
     if(trigger.gameObject.tag == "Water"){
        GetComponent.<ParticleEmitter>().enabled = false;
     }
}

Um… Not enough information.
Does collider have isTrigger set?
Does object colliding it have rigidbody?
Are you sure you’re not trying to collide 2D against 3D colliders?

Hi, thanks for the reply.
To answer your questions:
• Colliders (both objects) have their triggers set.
• Both have rigid bodies
• Both are 3D colliders.

This script is on a cube and I’m trying to have it trigger on another cube.

Let’s start from another angle: does Debug.Log(“Something”); work in OnTriggerEnter without any conditions?

Nothing seems to come up on the debugger.
Also checked to see if objects were on different layers and if colliders are touching.

#pragma strict

function Update ()
{}

function OnTriggerEnter(trigger : Collider) {
     if(trigger.gameObject.tag == "Water"){
         GetComponent.<ParticleEmitter>().enabled = true;
       Debug.Log("In water");
     }
}
function OnTriggerExit(trigger : Collider) {
     if(trigger.gameObject.tag == "Water"){
        GetComponent.<ParticleEmitter>().enabled = false;
         Debug.Log("Out of water");
     }
}

Got this line from debugger:

MissingComponentException: There is no ‘ParticleEmitter’ attached to the “New Sprite” game object, but a script is trying to access it. You probably need to add a ParticleEmitter to the game object “New Sprite”. Or your script needs to check if the component is attached before using it.
WaterTrigger.OnTriggerExit (UnityEngine.Collider trigger) (at Assets/WaterTrigger.js:15)

As far as I know they don’t use emitters anymore, but particle systems. Is this right?

All particles I used were ParticleSystem, yes. Afaik ParticleEmitter is old version of it(also called
“legacy particles” by manual).
But, well, it showed error that means at least trigger happened.

You should use ParticleSystem. It is quite new and pretty awesome. Then you can simply create a particle system and enable it. Then use OnTriggerEnter and gameObject.SetActive(true) to enable your particle system.

Used legacy ellipsoid particle emitter and it turns it on and off correctly.
Is there a way to do this with ParticleSystem?

Of course, but it’ll take time to finetune it. So I’d say if emitters work as intended, leave them be(as stated in my signature). Especially if you need ellipsoid - there’s no ellipsoid shape in ParticleSystem, only sphere and my attempts to simulate ellipse within 5 minutes failed.