using UnityEngine; public class ChaseCoinRandomizer : MonoBehaviour { [Header("Coin Parents (Only 0 or 1 will be activated)")] public GameObject[] coinParents; //[Header("Obstacle Parents (Random number and combination)")] //public GameObject[] obstacleParents; [Range(0, 100)] public int coinChance = 40; // 40% chance to show a coin group void Start() { RandomizeCoins(); // RandomizeObstacles(); } void RandomizeCoins() { // Deactivate all coin groups foreach (var coin in coinParents) coin.SetActive(false); // Random chance to activate one int roll = Random.Range(0, 100); if (roll < coinChance && coinParents.Length > 0) { int index = Random.Range(0, coinParents.Length); coinParents[index].SetActive(true); } } // void RandomizeObstacles() // { // foreach (var obstacle in obstacleParents) // { // // Each obstacle has independent 50% chance to be active // bool shouldActivate = Random.value < 0.5f; // obstacle.SetActive(shouldActivate); // } // } }