Hello, I am new to Unity, I installed it only a few hours ago. I have unity 5 but I am following a tutorial on Unity 4 or less. I installed the package SampleAssets and imported it, but I have errors. I didn’t change anything. Here’s the code:
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*.collider;*
if (col.attachedRigidbody != null)
{
Vector3 vel = collisionEvents*.velocity;*
col.attachedRigidbody.AddForce(vel*force, ForceMode.Impulse);
}
other.BroadcastMessage(“Extinguish”, SendMessageOptions.DontRequireReceiver);
i++;
}
}
}
}