Answer the question
In order to leave comments, you need to log in
How to make increment variable while true in unity c#?
I want to make the variable increment constantly (or once per second)
I wrote the following code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Timers;
using System;
public class SilSec : MonoBehaviour
{
void Update()
{
Silicon sil = new Silicon();
while (true)
{
sil.silicon++;
print("meow");
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Silicon : MonoBehaviour
{
public int silicon = 0;
}
Answer the question
In order to leave comments, you need to log in
Silicon sil = new Silicon();
void Update()
{
sil.silicon++;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question