I am currently unable to access a component I need to access. I want to get a float from the child (which is a gameobject) of an object.
public AudioSource pickup;
private GameObject pickingPlayer;
private GameObject weapon;
void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == "Player")
{
pickingPlayer = col.gameObject;
GeneralPlayerScript pickupPlay = pickingPlayer.GetComponent<GeneralPlayerScript>();
|ERROR HERE| = pickingPlayer.transform.Find("FishgrainBLOCKGun").gameObject;
FishGunFire FishGunFireScript = weapon.GetComponent<FishGunFire>();
FishGunFireScript.Ammo = FishGunFireScript.Ammo + 15;
pickup.Play();
if (pickupPlay.activeWeapon == 1)
{
FishGunFireScript.ammoText.text = FishGunFireScript.Ammo.ToString();
}
Destroy(gameObject);
}
}