0

I have started to try and give multithreading a go. I created a thread and want it to wait for a few seconds before it resumes.

public void Claim()
{
    Thread myThread = new Thread( () => SetFaction(Factions.Split));
    Debug.Log("starting");
    // wait for a few seconds

    // resume
}

public void SetFaction(Factions faction)
{
    Debug.Log("claimed");
}

I know unity has easier ways of completing this task, but as stated before I want to learn more about multithreading.

mowie2
  • 42
  • 6
  • 2
    *" I want to learn more about multithreading"* ...If you want to learn about Threads, just Google it. By the way, Unity uses C# not C. Using Thread just to wait in Unity is like mowing lawn with a grenade. If don't know when Thread should be used, don't use it at all in Unity. If you have a specific question about Thread, please feel free to edit your question with that. Until then, I will close as a duplicate since it looks like you just want to wait/sleep in Unity. – Programmer Dec 27 '17 at 03:32
  • I can't use sleep on the variable myThread. I have been googling which is why I'm asking the question here. When I use Thread.sleep the entire program freezes which is what I'm trying to prevent. – mowie2 Dec 27 '17 at 03:52
  • [Coroutines](https://docs.unity3d.com/Manual/Coroutines.html). – Draco18s no longer trusts SE Dec 27 '17 at 05:18

0 Answers0