Random Coins Spawnen

Can someone help me I also would like to have coins spawned in my game but since I’m still a new one I don’t know how it would be best if the coins had a 25% chance to Spawn of my randomly generated Platforms.

Hi @HundredDamage ,

In your spawning code, you can use the expression:

if (Random.value < 0.25f)
    SpawnCoin();
else
    SpawnSomethingElseOrNothing();

You can find more information about Random method here: Unity - Scripting API: Random.value

Good luck with your project!

Thank you

1 Like