cherub
1
ok, so i know almost nothing about scripting.
this works perfectly…
function OnMouseDown () {
particleEmitter.ClearParticles();
//and this works as well
transform.Translate(0, 0, 200);
}
but not this example
function OnMouseDown () {
//particleEmitter.ClearParticles();
//transform.Translate(0, 0, 200);
ParticleAnimator.damping (1.0);
}
i dont know why i get the error:
"An instance of type ‘UnityEngine.ParticleAnimator’ is required to access non static member ‘damping’.
Well, it just means you’re trying to access an initialized instance of the class through the class itself.
Just use gameObject.GetComponent(ParticleAnimator).damping(1,0);.
If you’re doing this often, you should probably put it in a variable, though.
Eric5h5
3
You want to use particleAnimator rather than ParticleAnimator. Capitalization is important.
–Eric
cherub
4
i tried
gameObject.GetComponent(ParticleAnimator).damping(1.0);
got
Method not found: ‘UnityEngine.ParticleAnimator.damping’
cherub
5
ok, so this worked
gameObject.GetComponent(ParticleAnimator).damping = 1;
go figure
That’s because damping is a property and not a method, so you set the value of the property, not call the function of the method.