Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Game Development Components in Unity Organizing Code into Methods Project Overview

Ranvir Sahota
Ranvir Sahota
9,844 Points

Error: ParticleCollisionSystem obsoleteuse colliderComponent

Assets/Standard Assets/ParticleSystems/Scripts/WaterHoseParticles.cs(41,48): error CS0619: UnityEngine.ParticleCollisionEvent.collider' is obsolete:collider property is deprecated. Use colliderComponent instead, which supports Collider and Collider2D components.'


2 Answers

Ranvir Sahota
Ranvir Sahota
9,844 Points

I found a fix and decided to post my solution just in case others find themselves in the same situation Comment out these lines (Line numbers should start around 42 and end at 48):

            /*var col = m_CollisionEvents[i].collider;
            var attachedRigidbody = col.GetComponent<Rigidbody>();
            if (attachedRigidbody != null)
               Vector3 vel = m_CollisionEvents[i].velocity;
                attachedRigidbody.AddForce(vel*force, ForceMode.Impulse);

You'll find the script here: Components in Unity\Assets\Standard Assets\ParticleSystems\Scripts\WaterHoseParticles.cs If anyone knows the game object name this script is attached to please inform me. I have tried to find the game object the script is attached but have failed. I would like to resolve this issue and the current fix could cause poblems later on.

Greg Austin
Greg Austin
10,890 Points

Or you could just do what the console says and change:

var col = m_CollisionEvents[i].collider;


var col = m_CollisionEvents[i].colliderComponent;

I think that's all there is to it...I'll confirm when I get through the rest without any related errors