I’m making a prototype FPS game, and I want my gun to play a particle system while shooting. I declared it in the class and selected it when the script was put on the gun. But I get this error:
'ParticleSystem' does not contain a definition for 'play' and no accessible extension method 'play' accepting a first argument of type 'ParticleSystem' could be found
(are you missing a using directive or an assembly reference?)```
The code is:
```csharp
using System;
using UnityEngine;
public class GunShootPistol : MonoBehaviour
{
public float damage = 10f;
public float range = 50f;
public Camera Cam;
public ParticleSystem flash;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
BulletShoot();
}
}
void BulletShoot()
{
flash.play();
RaycastHit hit;
if (Physics.Raycast(Cam.transform.position, Cam.transform.forward, out hit, range)) {
Debug.Log(hit.transform);
ShootingThings target = hit.transform.GetComponent<ShootingThings>();
if (target !=null)
{
target.TakeDMG(damage);
}
}
}
}
The script should play the particle system, but instead it says that it’s not containing the play function. I don’t know what can I do, and if someone would help me out, I’d really appreciate it.