- Home /
Question by
darkspirtdea · Mar 28, 2015 at 04:31 PM ·
problem during runtime
Standard Assets for Unity 4.6
Hello guys,
I'm trying to make the infinite runner game as directed by Mike Geig on 13 Mar 2014. But after downloading the Standard Assets for Unity 4.6. I receive the error:
Assets/SampleAssets/Effects/ParticleSystems/scripts/WaterHoseParticles.cs(7,32): error CS0426: The nested type CollisionEvent' does not exist in the type UnityEngine.ParticleSystem'
I can't fix the problem, but would really appreciate your help. Below is a copy of the script, thank you:
using UnityEngine;
namespace UnitySampleAssets.Effects { public class WaterHoseParticles : MonoBehaviour { private ParticleSystem.CollisionEvent[] collisionEvents = new ParticleSystem.CollisionEvent[16];
public static float lastSoundTime;
public float force = 1;
private void OnParticleCollision(GameObject other)
{
int safeLength = particleSystem.safeCollisionEventSize;
if (collisionEvents.Length < safeLength)
{
collisionEvents = new ParticleSystem.CollisionEvent[safeLength];
}
int numCollisionEvents = particleSystem.GetCollisionEvents(other, collisionEvents);
int i = 0;
while (i < numCollisionEvents)
{
if (Time.time > lastSoundTime + 0.2f)
{
lastSoundTime = Time.time;
}
var col = collisionEvents[i].collider;
if (col.attachedRigidbody != null)
{
Vector3 vel = collisionEvents[i].velocity;
col.attachedRigidbody.AddForce(vel*force, ForceMode.Impulse);
}
other.BroadcastMessage("Extinguish", SendMessageOptions.DontRequireReceiver);
i++;
}
}
}
}
Comment
Your answer