I want to make a particle, that will spawn lightning bolts, and if the lightning bolts touch the ground, aka instantly I want a sound to be played.
How can I do it? The unity documentation said that I should use OnParticleCollision(), but when I wrote that to my script it said unknown identifier.
Maybe my script is just noob, im not familiar with javascript. Could someone help me with a script that would do such thing properly?
maybe post some of your code so we can see whats going wrong? at least the part where you call OnParticleCollision()
I have no idea How I should really type the code, but I made it this way:
var sound : AudioClip;
function update()
{
OnParticleCollision(sound);
}
I know there should be sth like play sound, but I didnt know what exactly
var sound : AudioClip;
function OnParticleCollision()
{
if (sound)
{
audio.PlayOneShot(sound)
}
}
should work ![]()
you don’t need to put
function OnParticleCollision()
into a function Update as it is allready a function itself
I’d recomend the 3d tutorial to help you get to grasp with unitys Javascript (Unityscript)
here http://download.unity3d.com/support/resources/files/3DPlatformTutorial.pdf
ty, I will take a look at the tutorial rightaway ![]()