internal void Awake() { DontDestroyOnLoad(gameObject); threadarray = new ThreadObj[NumThreads]; for (int i = 0; i < NumThreads; i++) { threadarray[i] = new ThreadObj(); } }
private static void ThreadFunc(object obj) { ThreadObj thread = obj as ThreadObj; while (thread.Run) { int total = 0; for (int i = 0; i < 1000000000; i++) { total += i; } thread.count = total; } }
public void WindowGUI(int windowID) { GUILayout.BeginVertical(); for (int i = 0; i < NumThreads; i++) { ThreadObj thread = threadarray[i]; GUILayout.BeginVertical(); thread.Run = GUILayout.Toggle(thread.Run, "Thread", buttonStyle, buttonWidth); GUILayout.EndVertical(); } GUILayout.EndVertical(); GUI.DragWindow(); }