The problem:
flame.particleSystem.Play();
This line does not work. It says Unity. GetComponent does not contain a definition for particlesyste.play
using UnityEngine;
using System.Collections;
public class PullTrigger : MonoBehaviour {
public ParticleSystem flame;
public ParticleSystem flame2;
public GameObject explode;
public Camera c1;
public Camera c2;
public GameObject concrete;
public AudioSource fire;
public AudioSource fire2;
public AudioSource charge;
public GameObject gun;
public Light fl;
public GameObject blood;
public GameObject steel;
public GameObject undead1;
public GameObject undead2;
public GameObject undeaddog1;
public GameObject elite3;
public Collider coll;
public Collider walls;
public float timeBetweenShots = 0.3333f; // Allow 3 shots per second
private float timestamp;
public Rigidbody u1;
public Light l1;
public Light l2;
public GameObject bar1flames;
public GameObject bar1exp;
void Start() {
coll = GetComponent();
walls = GetComponent();
flame.GetComponent();
flame2.GetComponent();
u1 = GetComponent();
StartCoroutine(Example());
}
void Awake () {
Application.targetFrameRate = 60;
}
public void Update() {
if (Input.GetButtonDown (“Cam2”)) {
c1.enabled = false;
c2.enabled = true;
} else if (Input.GetButtonUp (“Cam2”)) {
c1.enabled = true;
c2.enabled = false;
}
if (Input.GetButtonDown (“F”)) {
fl.enabled = true;
} else if (Input.GetButtonDown (“G”)) {
fl.enabled = false;
}
if (Input.GetButton (“Trig1”) && Time.time >= timestamp) {
timestamp = Time.time + timeBetweenShots;
Ray ray = new Ray (flame.transform.position, flame.transform.forward);
RaycastHit hit;
fire.Play ();
if (Physics.Raycast (ray, out hit, 100)) {
//enemies hit
if (hit.collider.gameObject.layer == 0 && hit.collider != null) {
Instantiate (concrete, hit.point, Quaternion.identity);
//Destroy (undead1, 0.01f);
}
if (hit.collider.gameObject.layer == 11 && hit.collider != null) {
Instantiate (blood, hit.point, Quaternion.identity);
Destroy (undead1, 0.01f);
Destroy (hit.transform.gameObject);
//Destroy (undead1, 0.01f);
}
}
}
//GRENADE GRENADE GRENADE GRENADE GRENADE GRENADE GRENADE
}
}
}
IEnumerator Example() {
flame.particleSystem.Play();
yield return new WaitForSeconds(0.05f);
flame.particleSystem.Stop();
}
}