- Home /
InvokeRepeating doesn't work at 0.00002 seconds
Hello,
I am creating a game in which I can simulate digital circuitry and I would need to update every chip at about 0.00002 seconds or 20 microseconds. I tried to achieve that by using
InvokeRepeating("GlobalTick", 0.01f, 0.00002f);
but the code doesn't execute nearly close to that rate. How can I achieve a simulation of a tick at ~20 microseconds?
Please help, I'm banging my head over this for over 2 days.
EDIT :
I found a solution to my problem by using a MicroTimer class found HERE By creating a seperate class to handle time, I can now update all chips at 1 microsecond (1Mhz)!
I'm glad you found a solution. Can you please post an answer and accept it? This way people will might have the same problem know that an answer has been found. Thank you.
Answer by Eric5h5 · Jan 25, 2014 at 10:31 PM
It's unlikely that you actually need it to update that fast, but you could use threads to run a task separately from the Unity thread, and have it update at a specific rate (possibly involving Thread.Sleep or something). The Unity thread can then check the state of your thread from time to time as needed.
A thread is a good ide. Can you please post an example of using threads in unity and synchronizing them?
Nope, way out of scope for this question. You can find lots of info on threads with a search. Ask a new question if you're still having problems.
Your answer
Follow this Question
Related Questions
Invoke is not working properly. 0 Answers
What is the difference between InvokeRepeating & Invoke and how can they be used? 1 Answer
IndexOutOfRangeException: Array index is out of range 1 Answer
InvokeRepeating is not stoping. 2 Answers
how to stop InvokeRepeating when it calls a function in 0.1 second? 0 Answers