November 2018
Beginner
246 pages
5h 23m
English
Next, we set up our Bullet prefab with two orthogonal planes using a laser-like material and a Particles/Additive property in the Shader field:

The code in the Bullet.cs file is as follows:
using UnityEngine;
using System.Collections;
public class Bullet : MonoBehaviour
{
//Explosion Effect [SerializeField]
private GameObject Explosion; [SerializeField] private float Speed = 600.0f; [SerializeField] private float LifeTime = 3.0f; public int damage = 50; void Start() { Destroy(gameObject, LifeTime); } void Update() { transform.position += transform.forward * Speed * Time.deltaTime; } void OnCollisionEnter(Collision ...Read now
Unlock full access