Is there a way to add a world particle collider to a particle system through script. AddComponent(???);
If there's not a way to add it at runtime is there a way to enable/disable it?
Is there a way to add a world particle collider to a particle system through script. AddComponent(???);
If there's not a way to add it at runtime is there a way to enable/disable it?
Add it to the actual particle effect, then you can enable/disable it...
Use get component
http://unity3d.com/support/documentation/ScriptReference/GameObject.html
To get the component, and just .enable = false/true on which you want..
Should work =). Good luck!
Code:
function Update () {
if(Input.GetKeyDown("w")){
var test = gameObject.GetComponent("WorldParticleCollider");
print(test);
}
}
Preferably I'd like to create it in script with addComponent but I went ahead and added it to the prefab to try and control it that way. I can't seem to find out how to enable/disable it though. If I try to getComponent(Collider) it says there's not a collider attached. There's not an option, that I can find, for getting a WorldParticleCollider. Do you know the correct syntax for this?
– anon14224142Great! Thank you.
– anon14224142gameObject.GetComponent("WorldParticleCollider") It doesn't work at all.
– Yanger_xy