Files
ClearTheZone/Assets/Scripts/Shoot.cs
T

25 lines
469 B
C#

using UnityEngine;
public class Shoot : MonoBehaviour
{
[SerializeField] GameObject bulletPrefab;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Mouse0))
{
Shot();
}
}
public void Shot()
{
Instantiate(bulletPrefab);
}
}