Skip to content
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
4 changes: 2 additions & 2 deletions playground-unity/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.45f1
m_EditorVersionWithRevision: 2021.3.45f1 (0da89fac8e79)
m_EditorVersion: 2021.3.45f2
m_EditorVersionWithRevision: 2021.3.45f2 (88f88f591b2e)
4 changes: 2 additions & 2 deletions projects/TinkState-Unity-Test/TinkState-Unity-Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</ItemGroup>

<ItemGroup>
<Reference Include="UnityEngine">
<HintPath>../../unity-dlls/UnityEngine.dll</HintPath>
<Reference Include="UnityEngine.CoreModule">
<HintPath>../../unity-dlls/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TestRunner">
<HintPath>../../unity-dlls/UnityEngine.TestRunner.dll</HintPath>
Expand Down
4 changes: 2 additions & 2 deletions projects/TinkState-Unity/TinkState-Unity.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</ItemGroup>

<ItemGroup>
<Reference Include="UnityEngine">
<HintPath>../../unity-dlls/UnityEngine.dll</HintPath>
<Reference Include="UnityEngine.CoreModule">
<HintPath>../../unity-dlls/UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>

Expand Down
16 changes: 13 additions & 3 deletions src/TinkState-Unity/Runtime/UnityBatchScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@ void Progress(float maxSeconds)
// we have two queues and swap between them to avoid allocating a new list every time
var currentQueue = queue;
queue = nextQueue;
foreach (var o in currentQueue) o.Run();
foreach (var o in currentQueue)
{
try
{
o.Run();
}
catch (Exception e)
{
Debug.LogException(e);
}
}
currentQueue.Clear();
nextQueue = currentQueue;
}
Expand All @@ -62,7 +72,7 @@ void Progress(float maxSeconds)
}
}

float GetTimeStamp()
static float GetTimeStamp()
{
return Time.realtimeSinceStartup;
}
Expand Down Expand Up @@ -95,7 +105,7 @@ static PlayerLoopSystem[] AppendLoopSystem(PlayerLoopSystem[] subSystemList, Pla

static int FindLoopSystemIndex(PlayerLoopSystem[] subSystemList, Type systemType)
{
for (int i = 0; i < subSystemList.Length; i++)
for (var i = 0; i < subSystemList.Length; i++)
{
if (subSystemList[i].type == systemType)
{
Expand Down
30 changes: 29 additions & 1 deletion src/TinkState-Unity/Tests/TestUnityBatchScheduler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine.TestTools;
using TinkState;
Expand Down Expand Up @@ -104,4 +106,30 @@ void BindCallback(int value)
yield return null;
Assert.That(bindingCalls, Is.EqualTo(3));
}
}

[UnityTest]
public IEnumerator TestBindingExceptionNotStoppingProcessing()
{
var state = Observable.State(10);
var calls = new List<string>();
var binding1Called = false;
state.Bind(value =>
{
if (!binding1Called)
{
binding1Called = true;
calls.Add("a");
}
else throw new Exception("FAIL");
});
state.Bind(value =>
{
calls.Add("b");
});
Assert.That(calls, Is.EquivalentTo(new [] {"a", "b"}));
state.Value = 15;
yield return null;
LogAssert.Expect(LogType.Exception, "Exception: FAIL");
Assert.That(calls, Is.EquivalentTo(new [] {"a", "b", "b"}));
}
}
Binary file added unity-dlls/UnityEngine.CoreModule.dll
Binary file not shown.
Binary file removed unity-dlls/UnityEngine.dll
Binary file not shown.
Loading