Skip to content

fixed loom thread bug + add new symbol #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions UnityProject/Assets/Dependencies/JEngine/Core/Util/Loom.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using UnityEngine;
using System.Collections.Generic;
using System.Collections.Concurrent;

Expand Down Expand Up @@ -103,25 +102,31 @@ public static void QueueOnMainThread(Action action)
/// <param name="time"></param>
public static void QueueOnMainThread(Action action, float time)
{
Delayed.Enqueue(new DelayedQueueItem { Time = Time.time + time, Action = action });
Delayed.Enqueue(new DelayedQueueItem { Time = _curTime + time, Action = action });
}

/// <summary>
/// Current actions to process
/// </summary>
private static readonly List<Action> CurActions = new List<Action>(100);

/// <summary>
/// Current time
/// </summary>
private static float _curTime;

/// <summary>
/// Update loop on main thread
/// </summary>
static void Update()
{
_curTime = UnityEngine.Time.time;
var i = Delayed.Count;
while (i-- > 0)
{
if (Delayed.TryDequeue(out var item))
{
if (item.Time <= Time.time)
if (item.Time <= _curTime)
{
CurActions.Add(item.Action);
}
Expand All @@ -140,7 +145,7 @@ static void Update()
}
catch (Exception e)
{
Debug.LogException(e);
UnityEngine.Debug.LogException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static void InjectDefineSymbol()
var group = BuildPipeline.GetBuildTargetGroup(target);
var org = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
var d = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
string[] Symbols = new string[] { "INIT_JE" };
string[] Symbols = new string[] { "INIT_JE", "ILRuntime" };
List<string> dfList = d.Split(';').ToList();
dfList.AddRange(Symbols.Except(dfList));
d = string.Join(";", dfList.Distinct().ToArray());
Expand Down