- Home /
"on" and "off" the effect.
When you click on an object, the object should "disappear", and the effect should appear in its place.
public class Disappearance : MonoBehaviour
{
public GameObject eff;
public GameObject objectX;
void Start()
{
eff.SetActive(false);
}
void Update()
{
if(Input.GetMouseButtonDown(0))
{
eff.SetActive(true);
Destroy(GetComponent<MeshRenderer>());
}
}
}
The particle system is a child of the object, and the effect is immediately played as soon as the game starts, what's wrong? (
Comment