Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Laser : MonoBehaviour
{
[SerializeField]
private float _speed = 8.0f;
void Update()
{
transform.Translate(Vector3.up * _speed * Time.deltaTime);
if (transform.position.y >= 7)
{
Destroy(this.gameObject);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment