private void AddRoadBlock() { while (BlockPool.Count < FrontOffset) { TotalBlocks++; RoadBlock newRoadBlock = (RoadBlock)GetRandomBlock().Duplicate(); // Moves the block at the end of the last one newRoadBlock.Transform = newRoadBlock.Transform.Translated(Vector3.Forward * TotalBlocks); // Toggle the visibility on newRoadBlock.Show(); // Trigger the custom Enable function which probably enable the collisions depending on the type newRoadBlock.Enable(); // Connect the loading zone of the new block newRoadBlock.Connect("LoadZoneEntered", this, nameof(OnLoadZoneEntered), new Array { TotalBlocks }); // Give an ID to the block newRoadBlock.Name = BlockName(TotalBlocks); AddChild(newRoadBlock); BlockPool.Add(newRoadBlock); } }