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

Events no longer trigger component updates #1211

Merged
merged 4 commits into from
Nov 1, 2019
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Reactive components have been removed completely. [#1195](https://github.com/spatialos/gdk-for-unity/pull/1195)
- 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).
- 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)
- Empty component updates will no longer trigger callbacks when received. [#1211](https://github.com/spatialos/gdk-for-unity/pull/1211)

### Added

Expand All @@ -22,6 +23,7 @@

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

### Internal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.DependentSchema.DependentComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.DependentSchema.DependentComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.DependentSchema.DependentDataComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.DependentSchema.DependentDataComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
var eventsObject = op.Update.SchemaData.Value.GetEvents();

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.Tests.DependencyTestChild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.Tests.DependencyTestChild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.Tests.DependencyTest.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.Tests.DependencyTest.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.Tests.DependencyTestGrandchild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.Tests.DependencyTestGrandchild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.TestSchema.ExhaustiveEntity.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.TestSchema.ExhaustiveEntity.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.TestSchema.ExhaustiveMapKey.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.TestSchema.ExhaustiveMapKey.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.TestSchema.ExhaustiveMapValue.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.TestSchema.ExhaustiveMapValue.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.TestSchema.ExhaustiveOptional.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.TestSchema.ExhaustiveOptional.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.TestSchema.ExhaustiveRepeated.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.TestSchema.ExhaustiveRepeated.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public uint GetComponentId()

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = global::Improbable.TestSchema.ExhaustiveSingular.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = global::Improbable.TestSchema.ExhaustiveSingular.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
}

public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ namespace <#= qualifiedNamespace #>

public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
{
var update = <#= componentNamespace #>.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
{
var update = <#= componentNamespace #>.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
}
<# if (eventDetailsList.Count > 0) { #>
var eventsObject = op.Update.SchemaData.Value.GetEvents();
<# foreach (var ev in eventDetailsList) {
Expand Down