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

Commit b386cda

Browse files
authored
Events no longer trigger component updates (#1211)
* Events no longer trigger component updates. * Generated code * Changelog
1 parent c24247a commit b386cda

13 files changed

+62
-24
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Reactive components have been removed completely. [#1195](https://github.com/spatialos/gdk-for-unity/pull/1195)
88
- If you are using reactive components, please see our documentation on the [ECS workflow](https://docs.improbable.io/unity/alpha/workflows/overview#ecs-centric-workflow).
99
- Codegen for the GameObjectCreation package has been moved into the package. If the package is not used, readers and writers will no longer be generated. [#1196](https://github.com/spatialos/gdk-for-unity/pull/1196)
10+
- Empty component updates will no longer trigger callbacks when received. [#1211](https://github.com/spatialos/gdk-for-unity/pull/1211)
1011

1112
### Added
1213

@@ -22,6 +23,7 @@
2223

2324
- Fixed a bug where the Deployment Launcher window would accept tags with 33 characters. [#1202](https://github.com/spatialos/gdk-for-unity/pull/1202)
2425
- Fixed a small memory leak with command response callbacks using MonoBehaviours. [#1205](https://github.com/spatialos/gdk-for-unity/pull/1205)
26+
- Fixed an issue where events would trigger the `OnUpdate` callback on readers and writers. [#1211](https://github.com/spatialos/gdk-for-unity/pull/1211)
2527

2628
### Internal
2729

test-project/Assets/Generated/Source/improbable/dependentschema/DependentComponentComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.DependentSchema.DependentComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.DependentSchema.DependentComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

test-project/Assets/Generated/Source/improbable/dependentschema/DependentDataComponentComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.DependentSchema.DependentDataComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.DependentSchema.DependentDataComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
var eventsObject = op.Update.SchemaData.Value.GetEvents();
2427

2528
{

test-project/Assets/Generated/Source/improbable/tests/DependencyTestChildComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.Tests.DependencyTestChild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.Tests.DependencyTestChild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

test-project/Assets/Generated/Source/improbable/tests/DependencyTestComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.Tests.DependencyTest.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.Tests.DependencyTest.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

test-project/Assets/Generated/Source/improbable/tests/DependencyTestGrandchildComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.Tests.DependencyTestGrandchild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.Tests.DependencyTestGrandchild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

test-project/Assets/Generated/Source/improbable/testschema/ExhaustiveEntityComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.TestSchema.ExhaustiveEntity.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.TestSchema.ExhaustiveEntity.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

test-project/Assets/Generated/Source/improbable/testschema/ExhaustiveMapKeyComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.TestSchema.ExhaustiveMapKey.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.TestSchema.ExhaustiveMapKey.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

test-project/Assets/Generated/Source/improbable/testschema/ExhaustiveMapValueComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.TestSchema.ExhaustiveMapValue.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.TestSchema.ExhaustiveMapValue.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

test-project/Assets/Generated/Source/improbable/testschema/ExhaustiveOptionalComponentDiffDeserializer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public uint GetComponentId()
1818

1919
public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
2020
{
21-
var update = global::Improbable.TestSchema.ExhaustiveOptional.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
22-
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
21+
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
22+
{
23+
var update = global::Improbable.TestSchema.ExhaustiveOptional.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
24+
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
25+
}
2326
}
2427

2528
public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)

0 commit comments

Comments
 (0)