Question by 
               paetznick01 · Jan 05, 2016 at 02:57 PM · 
                scripting problemprefabsparticlesystemontriggerenteroncollisionenter  
              
 
              How do I make this script play a particle sytem from prefab
Im a novice programmer with unity; Im using unity 5. I am using this script
using UnityEngine; using System.Collections;
public class OneUseTrap : MonoBehaviour
{ 
 public int DamadgeOutput = 50;
 GameObject player;
 PlayerHealth playerHealth;
 BoxCollider BoxCollider; 
 void Awake ()
     
 {
     player = GameObject.FindGameObjectWithTag ("Player");                     
     playerHealth = player.GetComponent <PlayerHealth> (); 
     BoxCollider = GetComponent <BoxCollider> ();
     
 }
 
 void OnTriggerEnter (Collider other)
 {
     if (other.gameObject == player)
         
     {
         BoxCollider.isTrigger = true;
         playerHealth.TakeDamage (DamadgeOutput);
         Destroy (gameObject);
     }
     
 }
} 
The particle system I want to play is here
https://www.assetstore.unity3d.com/en/#!/content/11158
the particle systems are prefabs what are the steps I would take to add a particle system and make it play on collision (for a few seconds) using scripting
               Comment
              
 
               
              instantiate the prefab maybe onto the player?
 (GameObject)Instantiate(prefab, position, Quaternion.identity);
Answer by paetznick01 · Jan 07, 2016 at 03:39 PM
could you break it down a little more for example where would I attach the prefab? do I need to give it a name? Do I need to use the animator? What is Instantiate?
Ive never worked with particle systems before
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                