Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

MY effect dont destroy

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; public class bulletController : MonoBehaviour { public float moveSpeed = 20f, lifetime; public Rigidbody rb; public GameObject impactEffect; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { rb.velocity = transform.forward * moveSpeed; lifetime -= Time.deltaTime; if(lifetime <= 0) { Destroy(gameObject); } } void OnCollisionEnter(Collision collision) { Destroy(gameObject); Instantiate(impactEffect, transform.position, transform.rotation); } } [link text][1] [1]: https://streamable.com/6lqu96

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>