Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 384d61c

Browse files
authored
UTY-2647: bad sync point in ecs view manager (#1430)
* fix codege, lookup components from SpatialOSReceiveSystem * use explicit system * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md
1 parent 146d34a commit 384d61c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Fixed an `IndexOutOfRangeException` that could be thrown when editing your 'Build Configuration' asset. [#1441](https://github.com/spatialos/gdk-for-unity/pull/1441)
1212
- The 'Build Configuration' Inspector window will no longer report your Android SDK installation as missing if you have a completely fresh Unity installation with the bundled Android SDK. [#1441](https://github.com/spatialos/gdk-for-unity/pull/1441)
1313
- Fixed a bug where having spaces in the path to your project would cause the 'Local launch' and 'Launch standalone client' menu options to fail on MacOS. [#1442](https://github.com/spatialos/gdk-for-unity/pull/1442)
14+
- Fixed a faulty sync point caused by using `ComponentDataFromEntity` of the `WorkerSystem`. [#1430](https://github.com/spatialos/gdk-for-unity/pull/1430)
1415

1516
### Internal
1617

workers/unity/Packages/io.improbable.gdk.core/.codegen/Source/Generators/Core/UnityEcsViewManagerGenerator.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public static CodeWriter Generate(UnityComponentDetails componentDetails)
3333
{
3434
evm.Line($@"
3535
private WorkerSystem workerSystem;
36+
private SpatialOSReceiveSystem spatialOSReceiveSystem;
3637
private EntityManager entityManager;
3738
3839
private readonly ComponentType[] initialComponents = new ComponentType[]
@@ -63,7 +64,7 @@ public void ApplyDiff(ViewDiff diff)
6364
}
6465
6566
var updates = diffStorage.GetUpdates();
66-
var dataFromEntity = workerSystem.GetComponentDataFromEntity<Component>();
67+
var dataFromEntity = spatialOSReceiveSystem.GetComponentDataFromEntity<Component>();
6768
for (int i = 0; i < updates.Count; ++i)
6869
{
6970
ApplyUpdate(in updates[i], dataFromEntity);
@@ -92,6 +93,13 @@ public void Init(World world)
9293
{
9394
throw new ArgumentException(""World instance is not running a valid SpatialOS worker"");
9495
}
96+
97+
spatialOSReceiveSystem = world.GetExistingSystem<SpatialOSReceiveSystem>();
98+
99+
if (spatialOSReceiveSystem == null)
100+
{
101+
throw new ArgumentException(""Could not find SpatialOS Receive System in the current world instance"");
102+
}
95103
}
96104
");
97105
evm.Method("public void Clean()", m =>

0 commit comments

Comments
 (0)