I'm so nooby at unity. I'm trying to make a flappy bird clone and ı wanna fasten pipes which are coming toward bird. ı can fasten them but in game scene there are still slower pipes and it doesnt seem good how can ı solve this problem? Sorry for my English its not my mother tongue.
void Update()
{
if (firstTap && KlonlamaBirKereCalissin)
{
KlonlamaBirKereCalissin = false;
InvokeRepeating(nameof(PipeClonin), 1, 6f); ==> in first tap it start to cloning
}
if (score > 10 && KlonlamaBirKereCalissin10) ==> checking if score 10 and if the answer is yes i cancell earlier invoke and started faster one
{
// SlowPipes = GameObject.FindGameObjectsWithTag("Pipes"); ==> in here ı tried to faster last two slower pipes but ıt was wrong cos its update func and last two pipes are changing so the result is changing too
// SlowPipes[2].GetComponent<PipeMove>().PipeSpeed = 1.5f;
// SlowPipes[3].GetComponent<PipeMove>().PipeSpeed = 1.5f;
CancelInvoke(nameof(PipeClonin));
InvokeRepeating(nameof(PipeClonin), 1f, 5f);
KlonlamaBirKereCalissin10 = false;
pipeMoveScript.PipeSpeed = 1.5f;
This sounds more like a game design challenge/decision.
To stop having the faster pipes catch up with slower ones, the only solution that I can think of is speeding them all up.
It's hard to tell what the code you've provided does as there's no context and it's incomplete. So here's a simple generic implementation answer based on what you've said.
Some object and a script on it would be in charge of controlling the pipes, say
PipeController. This would have a methodSpawnNewthat handles instantiating new pipes, as well as adding them to a list, saypipes. Using this list, when you want to change the speed of all the pipes, you could just iterate over all thepipesand change their speed value.