D
D
Demigodd2017-03-10 10:19:02
Unity
Demigodd, 2017-03-10 10:19:02

How to save random value in unity3d?

public class TestScript : MonoBehaviour 
{
  public int RandomInt;

  public void RandomGo()
  {
    RandomInt =Random.Range(1,300000000); 
    PlayerPrefs.Setint("RSave", RandomInt);
  }
}

I threw off RandomGO on the UI Button. How to make a number that would be clicked on the button for the first time, and next. clicks loaded the created number?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2017-03-10
@Demigodd

We start a flag for which thread of the wasFirstTap type. In pressing, we check - if the flag is not raised - we generate a number, save it to a variable or wherever you need it; if we erect - we read from where it is necessary.
The question is trivial. It's too early for you to play the game.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question