How to collide and make a particle effect

Hello! So im currently working on a 3d game. In my game I want to have it so if my player walks on water then the player will get a water particle effect. My issue is I cant seem to get it to work.

using UnityEngine;
using System.Collections;

public class WaterParticleCollision : MonoBehaviour
{
           void OnTriggerEnter(collider other)
           {
                   if (other.CompareTag ("Water"))
                   {
                             renderer.enabled = true;
                   }
           }
}

//also water is the name of my tag for the pond (water) I want it to collide with

That is what I have written. It doesn’t work and I can’t figure out what’s wrong. I’m a beginner so sorry if this is like some dumb mistake. Anyway I hope I could get some help. Thankyou.

Hi and welcome.

General debugging approach:
The general mindset for debugging these kinds of things is breaking the problem down. You want to detect a collision and then play some particle effect, so there are two potential sources for the problem. First you should make sure that your condition actually gets triggers, ie a collision is detected. To check this you can place a Debug.Log() message into the OnTriggerEnter function and see if it gets printed when you expect it to be.
Also, you are currently using Triggers, not Collisions. This is probably even intended (?) , but it’s not the same.
Secondly, you want to play a particle effect. So if you find your condition to trigger at the expected moment, something with how you play the particle effect is wrong.

Your problem: (i think)
As for this case, it’s probably the latter. If you use the particle system (i’m not exactly experienced with it), i’m pretty sure you have to instantiate a particle effect at the desired location. Instead you are enabling some renderer (of which i have no idea what it does). Either way, even if your renderer contains a water particle effect, you’d be missing the location information. You may also want to look into this:

Edit: There should also be plenty of tutorials on this kind of stuff, so just try looking some up on youtube. I’m not suggesting you just copy their result scripts, but instead try to write them while going with the tutorial and learn how and why things work. This will help you be more flexible when approaching your own problems later on.

Thanks for the tips. I’m going to look into it, there were some issues in the script that i was having trouble with and this helps me a tonne, thankyou!