mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 05:50:18 +00:00
start thread also in edit mode
This commit is contained in:
parent
86ed0369a7
commit
a3cddc0209
1 changed files with 22 additions and 4 deletions
|
@ -75,12 +75,21 @@ namespace SanAndreasUnity.Behaviours
|
||||||
public ushort maxTimePerFrameMs = 0;
|
public ushort maxTimePerFrameMs = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
[UnityEditor.InitializeOnLoadMethod]
|
||||||
|
static void InitOnLoadInEditor()
|
||||||
|
{
|
||||||
|
if (null == Singleton)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Singleton.StartThread();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected override void OnSingletonStart()
|
protected override void OnSingletonStart()
|
||||||
{
|
{
|
||||||
|
this.StartThread();
|
||||||
_thread = new Thread (ThreadFunction);
|
|
||||||
_thread.Start(_threadParameters);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSingletonDisable()
|
protected override void OnSingletonDisable()
|
||||||
|
@ -97,6 +106,15 @@ namespace SanAndreasUnity.Behaviours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StartThread()
|
||||||
|
{
|
||||||
|
if (_thread != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_thread = new Thread(ThreadFunction);
|
||||||
|
_thread.Start(_threadParameters);
|
||||||
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
this.UpdateJobsInternal();
|
this.UpdateJobsInternal();
|
||||||
|
|
Loading…
Reference in a new issue