how to decrease repeating time in invokerepeating?

In my below code, random object falls with Invokerepeating() finction. But the problem is, i want repeating time to be decreased with constantly repeating value from 1.0f to 0.5f with decreasing rate of 0.05f. So that, as time passes, the object start falling more fast and game becomes hard. How to do that?

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class Poolingscript2 : MonoBehaviour {

public	GameObject[] allprefabs;
public	List<GameObject> bullets ;
public	int listsize;
GameObject go;
// Use this for initialization
void Start ()
{
	createlist ();
	InvokeRepeating ("fallobject", 2.0f,1.0f);
}

void createlist()
{
 	allprefabs = Resources.LoadAll<GameObject> ("Prefab");

	for (int i=0; i<listsize; i++) 
	{
		foreach (GameObject allprifab in allprefabs) 
		{
			go = Instantiate(allprifab)as GameObject;
			go.SetActive(false);
			bullets.Add (go);
		}
	}
}

GameObject temp;
void fallobject()
{
	int randm = Random.Range(0,listsize);
	temp = bullets.ElementAt(randm);
	bullets.Remove(temp);
	temp.transform.position = transform.position;
	//yield return new WaitForSeconds (10.0f);
	temp.SetActive(true);	
}

float getdrag(float dr)
{
	float dr1;
	float rnd_drag = Random.Range (0.5f, 0.5f);
	dr1 = rnd_drag;
	return dr1;
}

public void Update()
{

}

public void addtolist(GameObject g)
{
	g.SetActive (false);
	bullets.Add (g);
}

}

You can’t. You can only cancel repetitive invokation and start a new one with new timings. My advice is run your own custom repetitive invokation in an Update method but with checking whether some “elapsed time” (+= Time.deltaTime) variable is over a certain value. Play around with that value then to control the frequency.

okay, let me try. Thank You. :slight_smile: