Invoke script in child problem. Solved. Close Please.

Why the hell is this not working?

What I want is to get the Shoot function in the RifleAI script. I got it to work before all the Raycasting chaos and now forgot how the hell I did it.

Main thing is that I can’t access any of the functions in the RifleAI code or can’t call them.
So yeah, how and why can’t I get the Shoot() Function in the RifleAI? It worked before…

This is the Code in the parent, which is main AI that I had issues with earlier.

// this is the weapon in children IE the hand.
public GameObject weapon01;

// this is the script definition...
private RifleAI weaponRifleScript;


void Start(){

// tell it to get the specific RifleAI in the child.
weaponRifleScript = weapon01.GetComponent<Rifle>();
  
}

void Update{

 if(canShoot == true){

   Shooting();    
}
  

}

void Shooting(){
  
  weaponRifleScript.InvokeRepeating("Shoot", 1, 0.1f);
   

}
}

… and the code in the RifleAI:

public Transform projectile;

//... and a few more public things that I can see in the parent script.


void Start {



}

// this is what shoots the projectiles. Its works, as I changed nothing here.

void Shoot(){

   Instantiate bla bla bla.

   
  // it shoots, so problem can't be in here, has to be in the main script. 
}

you need to make your shoot function public

public void Shoot()
{
}