InvokeRepeating not working for some reason

Hi there,

everything is lined up in my code.
When I just call…

fireProjectile();

…it fires but when I call…

InvokeRepeating("fireProjectile", 0.1, 0.1);

…it does not.

:. puzzled.

Is fireProjectile an abstract method?

function OnMouseDown(){
InvokeRepeating("fireProjectile", 0.1, 0.1);
}

function fireProjectile(){ 
}

Not sure what you mean by abstract.
This is essentially the code.

That’s different than the code you have in the first post. Either way, if you’re going to only a bit of code which may or may not be representative of what you’re trying, you’re actively working against people who would like to help you.

How do you know it’s not working if the method you’re calling doesn’t do anything?

Here is the code.
I am using if statements, however if I replace InvokeRepeating(functionName) with just functionName() in the if layer == 9, it runs. So As I said ealier, everything is running fine. But when I place in the InvokeRepeating it does not pass to the correct… or any function. I removed all CancelInvoke() statements so that could not be what is preventing the call.

Unsure.
thanks.

function OnMouseDown(){
	print("|||||OnMouseDown()||||||||");
	///all wpns triggered here. 
	///some are single fire
	///some multiple
	///some power up
	
	//insure correct hero is used as ref
	activeHero = heroManagerData.activeHero;	

	if(activeHero.layer == 8)
	{
		print("8 is active");
		fireProjectile(); 
		return;
	}
	if(activeHero.layer == 9)
	{
		print("9 is active");
		InvokeRepeating("fireProjectile", 0.1, 0.1);
		print("just told wpnRelam to fireProjectile as MG101 type" );
		return;
	}	 
	if(activeHero.layer == 10)
	{
		print("10 is active");
		
		GunPwr++;
		print("GunPwr" + GunPwr);
		
		//set animation of laserGun Powering up (pixie star dust around gun nozzle.)
		//play warming up noise
		//increase power meter (visual reference of power level)
		return;
	}	
}

function fireProjectile(){ 
	/// this function is responsible for all firing of projectiles for each wpn type.
	print("firePorjectile");
}

Bump.
Seriously odd that this does not work.

As I say, if I place a call to…

doThis();
at said point it goes on to that function.

but
InvokeRepeating(“doThis”, 2.0, 1.0);
does not fly.

When you say it doesn’t work - what does it do? Print nothing? Print once and not repeat? Throw exception?

No,
it reaches the instruction to InvokeRepeat, but does not follow thru to the function.