Hello.
I am trying to get a water particle system to come out of a faucet when I turn one of the handles (used with a hinge joint).
I check for the angle of the faucet, and successfully output the correct message to the console, so I know the if statement if working on it’s own, however, “water.Play()” does not seem to start the particle animation.
Just for the record, the faucet handles are not children of the faucet object, but the water particle system is.
Also, I tried unchecking “looping” for the particle system, which did not fix it.
As commented out in my code below, I also tried “water.enableEmission = true/false”, which also did not work.
Should I be using another function to play the system, such as “instantiate”?
Thank you, and here is the simple code I am using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FaucetHandle : MonoBehaviour
{
public GameObject handle;
public ParticleSystem water;
void Update()
{
if(handle.transform.localRotation.eulerAngles.y > 190)
{
water.Play();
//water.enableEmission = true;
Debug.Log("Water playing. Rotation: " + handle.transform.localRotation.eulerAngles.y);
}
else
{
water.Stop();
//water.enableEmission = false;
Debug.Log("Water stopped. Rotation: " + handle.transform.localRotation.eulerAngles.y);
}
}
}