help needed for making attack

hi i am a beginner to unity

i have created an effect with particle system and I have converted it to a prefab. i would like to turn that prefab into an attack so if i press 1 my character does the attack. Can someone please help. i don't know much scripting.

and can some one refer me to resources which can help me make hp / damage and particle collisions scripts

all help would be great

My understanding is you can do it like this:

1) Make your particle system (GameObject>Create Other>Particle System)

2) Create an empty prefab in your Project Folder (Create>Prefab or R-Click>Create>Prefab)

3) Drag your particle system into the new prefab (you can then delete the particle system in your scene)

4) Create a javascript to instantiate the prefab

var newObject : Transform;

function Update () {

    if (Input.GetKeyDown("m")){
        Instantiate(newObject, transform.position, transform.rotation);

5) Place this script on an object, such as your player character

'newObject' stores a reference to the prefab you want to instantiate so you will need to assign this prefab to the New Object slot in the Inspector.

6) You will want to destroy the cloned prefab after the effect, otherwise you will end up with lots of them in your scene (whether you can see them or not) so remember to tick 'one shot' in Particle Emitter settings and 'auto destruct' in the Particle Animator settings.

If you are instantiating an object instead, something like the following could be placed on the prefab (the '5' means 'destroy after 5 seconds'):

function Start(){

hello, the easiest way you can achieve that , is by Insitantiating the particle prefab, when a button is pressed, then give the instantiated copy a velocity in the direction you want.


Your question is very broad. You should look at some basic scripting documentation and maybe some tutorials to get started. When you have a more specific question, I am sure you will get answers.