Could someone help me with my problem - i got script which makes a clone of particles after casting it
#pragma strict
private var ray : Ray;
private var hit : RaycastHit;
var particles : Transform;
function Start () {
}
var speed = 20;
var time=2.0;
function Update () {
time = time + Time.deltaTime;
if (Input.GetMouseButtonUp(1)&&time>=2.0) {
time=0.0;
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, hit)){
transform.position.x = hit.point.x;
transform.position.z = hit.point.z;
Instantiate (particles, transform.position, transform.rotation);
}
}
}
- this script making clone called "teleport(clone)" - how can i destroy this clone after casting
- i tried scripts with Destroy(); but it doesnt work for me
Sorry for bad english
↧