Simple Instantiate code snippet

Simple code snippet

using UnityEngine;

using System.Collections;

public class VFXspawn : MonoBehaviour

{

public GameObject vfxPrefab;

public GameObject Original;

public Transform SpawnPoint;

void Update()

{

if(Input.GetKeyDown(KeyCode.Mouse0))

{

Instantiate(vfxPrefab, SpawnPoint.position, SpawnPoint.rotation);

Destroy(Original);

GetComponent<AudioSource>().Play();

}

}

}

Featured Posts
Recent Posts
Archive