I made a script to make sure that it registers my click by logging “Test” to the debug console but when i test the game and click, nothing happens. Script:
using UnityEngine;
using System.Collections;
public class Weapon : MonoBehaviour {
public float fireRate = 0;
public float Damage = 10;
public LayerMask notToHit;
float timeToFire = 0;
Transform firePoint;
// Use this for initialization
void Awake () {
firePoint = transform.FindChild ("firePoint");
if (firePoint == null) {
Debug.LogError ("Firepoint not found, something went wrong");
}
}
// Update is called once per frame
void Update () {
if (fireRate == 0);
if (Input.GetButtonDown ("Fire1")) {
Shoot();
}
else
{
if (Input.GetButton ("Fire1") && Time.time > timeToFire) {
timeToFire = Time.time + 1/fireRate;
Shoot();
}
}
}
void Shoot() {
Debug.Log ("Test");
}
}
Edit: Here’s some screenshots
My hierachy (My game is in very early not even alpha): Screenshot - d3bcb58cbc48b9af3918a2d9a8701385 - Gyazo
The Player Pt. 1: Screenshot - c2ee425c42e6280b95e1dc2a70a37f2c - Gyazo
The Player Pt. 2: Screenshot - dc5d4eb9f0996cea5a8f35c7fd33e7a5 - Gyazo
A GIF of my game (The low framerate is only in the debug mode, it runs smoothly when i play the built version): Screen capture - 2151b8e13305e6a03b27576436bd8297 - Gyazo