Y
Y
Yura Mailler2020-08-13 13:42:25
C++ / C#
Yura Mailler, 2020-08-13 13:42:25

How to make code that repeats infinitely in C#?

Hello, I need to make this code repeat indefinitely without using loops (Unity freezes when using loops)

public Text myText;
    public static int Text ;
    void Start()
    {        
        gameObject.GetComponent<Text>();  
        // ------------------------------------------------------------ вот это место
        Text = 1000;     
        myText.text = "$ : " + Text ;
        Text++;
        Thread.Sleep(5000);
       //------------------------------------------------------------------------------------------------
    }

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
SKEPTIC, 2020-08-13
@Yura111

void Update()
{
//тут твой код
}

Or no longer rolls?

D
Dmitry Pavlov, 2020-08-13
@Stalker31

vode Start(){
//Start code
Start();
}

S
Samuel_Leonardo, 2020-08-14
@Samuel_Leonardo

Formulate the problem correctly and you can easily find the answer
answers.unity.com/answers/1220845/view.html

D
DANICH70, 2021-01-20
@DANICH70

If infinite, then the cycle, but you said that it doesn’t roll, therefore

vode Update(){
//код
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question