Question by
$$anonymous$$ · Mar 23, 2016 at 10:51 PM ·
c#variablesprojectile
Unreferenced label?
I'm new to Unity as well as C#. I'm not sure why I'm getting the warning "The label has not been referenced". It is referring to projectile.
public int bulletSpeed;
public GameObject projectilePrefab;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
GameObject projectile = Instantiate(projectilePrefab, transform.position + transform.forward, transform.rotation) as GameObject;
projectile:GetComponent<Rigidbody>().AddForce(transform.forward * bulletSpeed);
}
}
Comment