some scripting help

hey everybody i’m still realy new to unity and i’m trying to write a script but i’m affraid i need some help.

i had a cube where i added a particle renderer a particle emitter and a particle animator.
i have a script that enables me to turn those off.
but i also have a box collider on the cube that i want to turn off when the particles are off.

that’s were i came up with this:

if( ParticleRenderer == false || BoxCollider == false )

only thing is that it doesn’t work.

it gives me an error that says:

Assets/firesteptrough.js(2,1): BCE0043: Unexpected token: .

while there is nothing there.

so if you’re willing to help me a bit with this i thank you.

Could you rephrase your second line, it’s not very clear ?

Anyway, ParticleRenderer and BoxCollider are types, not boolean. You probably mean

if( !GetComponent( “ParticleRenderer” ).enabled || !collider.enabled ) …

Is this line 2? One thing to point out right off the bat is the use of BoxCollider and ParticleRenderer. They should reference a specific instance of the class and not the class itself. Instead it would look more like.

public var myPlayer:Transform;

function Start()
{
    if(myPlayer.collider.enabled==false)//Do something
}

Here i am referencing the collider on the object player where collider will refer to whatever collider is there whether its a box, sphere, or other. If you have multiple colliders you would need to get the correct collider by using GetComponent(BoxCollider). As for the ‘particle renderer’, you may just want to do whatever when it is done emitting?

if(!myParticleSystem.isPlaying)//Do Something

so in your context in would be

if(!myParticleSystem.isPlaying)
{
    objectInQuestion.collider.enabled=false;
}