mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-22 12:03:04 +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;
|
||||
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.InitializeOnLoadMethod]
|
||||
static void InitOnLoadInEditor()
|
||||
{
|
||||
if (null == Singleton)
|
||||
return;
|
||||
|
||||
Singleton.StartThread();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnSingletonStart()
|
||||
{
|
||||
|
||||
_thread = new Thread (ThreadFunction);
|
||||
_thread.Start(_threadParameters);
|
||||
|
||||
this.StartThread();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
this.UpdateJobsInternal();
|
||||
|
|
Loading…
Reference in a new issue