How I can stop trail render emiting?
I have an array of trailrenders and I have a script whitch when the handbrake toggle is on , trailrenders need to start emitting and when the hand brake toggle is off to stop emitting but dosen t work. I tried to call the function in handbrake script but nothing. Here is the script using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CarParticlesControl : MonoBehaviour { public CarController Car; public ParticleSystem[] WheelsSmoke; public TrailRenderer[] SkidMask; public Toggle Handbrake;
private void Start()
{
Handbrake = GameObject.FindWithTag("HandBrake").GetComponent<Toggle>();
foreach (TrailRenderer T in SkidMask)
{
T.emitting = false;
}
}
public void StartSmoke()
{
if ( Handbrake.isOn)
{
foreach (TrailRenderer T in SkidMask)
{
T.emitting = true;
}
}
else
{
foreach (TrailRenderer T in SkidMask)
{
T.emitting = false;
}
}
}
}
Your answer

Follow this Question
Related Questions
[Resolved] Image not changing on Toggle 1 Answer
Have UI toggle and sliders trigger sounds? 0 Answers
Teleporting trail renderer 3 Answers
Unity Trail Renderer Shows in Unity Editor but not in-game. 0 Answers
toggle button blinks 1 Answer