Question by
abdesaddeq · Jun 04, 2017 at 01:37 PM ·
unity 5colliderunity5collider2dcomponent
how i can resolve this prob?
The Console is giving the error: error CS0619: UnityEngine.ParticleCollisionEvent.collider' is obsolete:
collider property is deprecated. Use colliderComponent instead, which supports Collider and Collider2D components.' ......................
using System; using UnityEngine;
namespace UnityStandardAssets.Effects { public class WaterHoseParticles : MonoBehaviour { public static float lastSoundTime; public float force = 1;
private ParticleCollisionEvent[] m_CollisionEvents = new ParticleCollisionEvent[16];
private ParticleSystem m_ParticleSystem;
private void Start()
{
m_ParticleSystem = GetComponent<ParticleSystem>();
}
private void OnParticleCollision(GameObject other)
{
int safeLength = m_ParticleSystem.GetSafeCollisionEventSize();
if (m_CollisionEvents.Length < safeLength)
{
m_CollisionEvents = new ParticleCollisionEvent[safeLength];
}
int numCollisionEvents = m_ParticleSystem.GetCollisionEvents(other, m_CollisionEvents);
int i = 0;
while (i < numCollisionEvents)
{
if (Time.time > lastSoundTime + 0.2f)
{
lastSoundTime = Time.time;
}
var col = m_CollisionEvents[i].collider;
if (col.attachedRigidbody != null)
{
Vector3 vel = m_CollisionEvents[i].velocity;
col.attachedRigidbody.AddForce(vel*force, ForceMode.Impulse);
}
other.BroadcastMessage("Extinguish", SendMessageOptions.DontRequireReceiver);
i++;
}
}
}
} ................................. Any ideas how to fix this erreur?
Thanks
Comment
Your answer
Follow this Question
Related Questions
Collision problems 0 Answers
Prefab is not the same as the object? 0 Answers
Bullet destroy 2 game object intent one Unity 2D 0 Answers
Triggers colliding with triggers 1 Answer
2d Tilemap collidor not working 0 Answers