I’ve been making a game and, in the game’s lobby I have a trigger that will send you to another scene. Now, I need a way to have something that will make it so that it sends the player to one of many scenes 49 times, then have the 50th time send you to a specific scene, then another 49 times and the 100th be specific. Anyone know a way to do this? Remember there are some scenes I never want it to transition to, and that I want many possibilities. Thanks.
You need a persistent counter that you increment at each “played level,” whatever that means for you.
Then before you choose to load a level, you compare that to 50, or compare to 100, and take appropriate action.
If you want it for EVERY level divisible by 50, use the modulo operator (%
) and check the remainder for being zero.
if ((yourAge % 7) == 0)
{
Debug.Log( "Your age is divisible by 7!");
}
NOTE: “persistent counter” in your case may mean something stored in PlayerPrefs alongside other saved user progress like score, or it could be less-persistent, such as only kept for the game duration.
Thanks. I’ll do some research.