Thanks! Only problem I find with this is that it would be difficult to instantiate 8 different prefabs each after each other every second.
InvokeRepeating( "CreateAsteroid1", 0, 1 );
InvokeRepeating( "CreateAsteroid2", 1, 1 );
InvokeRepeating( "CreateAsteroid3", 2, 1 );
InvokeRepeating( "CreateAsteroid4", 3, 1 );
InvokeRepeating( "CreateAsteroid5", 4, 1 );
InvokeRepeating( "CreateAsteroid6", 5, 1 );
InvokeRepeating( "CreateAsteroid7", 6, 1 );
InvokeRepeating( "CreateAsteroid8", 7, 1 );
This creates 8 after each other for the first 8 seconds, but after that I would be instantiating 8 prefabs per second.
Would it be possible to have function pointers, and loop through them like this?
InvokeRepeating( /* LOOP EACH FUNC PTR HERE*/, 0, 1 );
Or something similar?
Or code the above code become something like this?
static int i = 0;
InvokeRepeating( "CreateAsteroid1", i, 1 );
i++;
InvokeRepeating( "CreateAsteroid2", i, 1 );
i++;
InvokeRepeating( "CreateAsteroid3", i, 1 );
i++;
InvokeRepeating( "CreateAsteroid4", i, 1 );
i++;
InvokeRepeating( "CreateAsteroid5", i, 1 );
i++;
InvokeRepeating( "CreateAsteroid6", i, 1 );
i++;
InvokeRepeating( "CreateAsteroid7", i, 1 );
i++;
InvokeRepeating( "CreateAsteroid8", i, 1 );
i++;
Would that cause them each to happen after each? I don’t think it would, but I’m not sure…
EDIT - Would this work?
InvokeRepeating( "CreateAsteroid1", 7, 1 );
InvokeRepeating( "CreateAsteroid2", 6, 2 );
InvokeRepeating( "CreateAsteroid3", 5, 3 );
InvokeRepeating( "CreateAsteroid4", 4, 4 );
InvokeRepeating( "CreateAsteroid5", 3, 5 );
InvokeRepeating( "CreateAsteroid6", 2, 6 );
InvokeRepeating( "CreateAsteroid7", 1, 7 );
InvokeRepeating( "CreateAsteroid8", 0, 8 );