- Home /
Change color of WaterPro (Standard Assets) when a Particle touch it,Particle Collision with Water and change Refraction Color
Hello, I'm having problems trying to code it with c# because when I try to collide the particle with the water there isn't any answe from debug.log. Here we can see the particle configuration and the water configuration. Basically I want to change the Reflection color to red when the particle (blood) collides with the water. I tryied this but obviously don't work.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bloodcolour : MonoBehaviour {
// The particle system you want to change
private GameObject water;
private GameObject blood;
// The new material you want to apply to the particle system
public Renderer rend;
public Material colorwater;
public Shader shader;
private void Start()
{
water = GameObject.FindWithTag("Water");
// Access the 'ParticleSystemRenderer' component, and change the material to 'newMaterial'.
blood.GetComponent<ParticleSystemRenderer>().material = colorwater;
}
void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == "Water")
{
water.renderer.material.SetColor("_horizonColor", Color.red);
}
}
}
I'm waiting for your answer!
,Hello, I'm trying to find some tutorials but there aren't any tutorial that can help me with this.
The particle fall from the head of the player gameObject and falls colliding with the water, I'm trying to change the refraction color but I can't get this variable. This is the configuration that I'm using in my particle.
Basicaly I want to change the color of the water from base to red when the particle (blood) touch it.
Your answer
Follow this Question
Related Questions
WaterProDayTime and fire reflection issue 0 Answers
How to get Post Processing bloom working with 2D particles in URP? 0 Answers
disabling shadow casting with SSE 0 Answers
Why does specular highlight ignore vertex position? 1 Answer
Blending Reflection 0 Answers