mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-22 20:13:02 +00:00
check if background thread is running
This commit is contained in:
parent
edaee31998
commit
3217beb0e9
2 changed files with 27 additions and 0 deletions
|
@ -161,6 +161,13 @@ namespace SanAndreasUnity.Editor
|
||||||
|
|
||||||
if (this.IsExportingFromGameFiles)
|
if (this.IsExportingFromGameFiles)
|
||||||
{
|
{
|
||||||
|
LoadingThread.Singleton.EnsureBackgroundThreadStarted();
|
||||||
|
if (!LoadingThread.Singleton.IsBackgroundThreadRunning())
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("", "Background thread for asset loading is not running. Try restarting Unity.", "Ok");
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Loader.HasLoaded)
|
if (!Loader.HasLoaded)
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayDialog("", "Game data must be loaded first.", "Ok");
|
EditorUtility.DisplayDialog("", "Game data must be loaded first.", "Ok");
|
||||||
|
|
|
@ -241,6 +241,26 @@ namespace SanAndreasUnity.Behaviours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsBackgroundThreadRunning()
|
||||||
|
{
|
||||||
|
ThreadHelper.ThrowIfNotOnMainThread();
|
||||||
|
|
||||||
|
if (null == _thread)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (_thread.ThreadState != System.Threading.ThreadState.Running)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnsureBackgroundThreadStarted()
|
||||||
|
{
|
||||||
|
ThreadHelper.ThrowIfNotOnMainThread();
|
||||||
|
|
||||||
|
this.StartThread();
|
||||||
|
}
|
||||||
|
|
||||||
static void ThreadFunction (object objectParameter)
|
static void ThreadFunction (object objectParameter)
|
||||||
{
|
{
|
||||||
ThreadParameters threadParameters = (ThreadParameters) objectParameter;
|
ThreadParameters threadParameters = (ThreadParameters) objectParameter;
|
||||||
|
|
Loading…
Reference in a new issue