I thought what I was planning on doing was simple, but for some reason this function is not being defined correctly. It is something I have done before but this time it does not work. I have two C# scripts and I am trying to call a function from one within the other. What I have is this:
Script 1:
public class BulletScript : MonoBehaviour
{
private float angle;
void Start()
{
angle = 23f;
}
public float getAngle()
{
return angle;
}
}
Script 2:
public class SMG : MonoBehaviour
{
private float angle;
private BulletScript objectBulletScript;
void Start ()
{
objectBulletScript = GetComponent<BulletScript>();
angle = objectBulletScript.getAngle();
}
}
There are various other elements in the scripts but this is the basis of where the fault is occuring. This is the only declaration of 'BulletScript' within this class. Everything else works appropriately and does not interact with this process. The error message I am getting is: 'BulletScript' does not contain a definition for 'getAngle()'
Does anyone have any ideas where I went wrong.