I have a problem to launch my script, it prevents the game from launching, help me correct it please, it’s for a FPS, unity 2019 1.10f1 cannot launch it i think. ;(
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WeaponManagerG36C : MonoBehaviour {
public float range = 500f;
public int bulletsPerMag = 31; //Nombres de balles par chargeur ;)
public int bulletsLeft = 310; //Notre reserve de munition
public int currentBullets; //Les balles que l'on as
public float fireRate = 0.1f;
float fireTimer;
public Transform shootPoint;
// Start is called before the first frame update
void Start()
{
currentBullets = bulletsPerMag;
}
// Update is called once per frame
void Update()
{
if(Input.GetButton("Fire1"))
{
Fire();
}
if (fireTimer < fireRate)
fireTimer += Time.deltaTime;
}
private void Fire()
{
if (fireTimer < fireRate) return;
RaycastHit hit;
if(Physics.raycast(shootPoint.position, shootPoint.forward, out hit, range))
{
Debug.Log(hit.transform.name + " has been found!!!!!!");
}
fireTimer = 0.0f;
}
}