am trying to make a cannon, that once activated, fires at a fixed rate, however when I apply my C# code to my Empty Game Object, none of my public variables appear and I cannot adjust Velocity, apply my cannonball prefab, or anything. I cannot even start the game as it says all complier errors must be resolved. i do not know what I have messed up on. pleas someone check my code and give me tips.
using UnityEngine;
using System.Collections;
public class cannonball : MonoBehaviour {
public Rigidbody projectile;
public int throwPower;
public int fireRate;
public int nextFire;
// Use this for initialization
void Start () {
projectile = projectile.GetComponent<Rigidbody> ();
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown ("Horizontal")&&Time.time>nextFire) {
nextFire = Time.time + fireRate;
Rigidbody clone = Instantiate (projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection (Vector3.forward * throwPower);
}
}
}