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

Make reactive components opt-in #1059

Merged
merged 14 commits into from
Jul 23, 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- `DynamicSnapshot` and `DynamicConverter` have been collapsed into `Dynamic`. [#1053](https://github.com/spatialos/gdk-for-unity/pull/1053)
- The delegates from all of these classes are now available in the `Dynamic.VTable<TData, TUpdate, TSnapshot>` struct.
- `Dynamic.IHandler.Accept` now takes a `Dynamic.Vtable<TData, TUpdate, TSnapshot` parameter.
- Reactive components are now **opt in** instead of **opt out**. Use the scripting define `USE_LEGACY_REACTIVE_COMPONENTS` to re-enable them. [#1059](https://github.com/spatialos/gdk-for-unity/pull/1059)
- Note that these will be removed in a future release.

### Added

Expand All @@ -20,6 +22,10 @@
- Upgraded to Worker SDK 13.8.2. [#1052](https://github.com/spatialos/gdk-for-unity/pull/1052)
- The new [`Entity` schema type](https://docs.improbable.io/reference/13.8/shared/schema/reference#primitive-types) is deserialized as an `Improbable.Gdk.Core.EntitySnapshot`. [#1053](https://github.com/spatialos/gdk-for-unity/pull/1053)

### Fixed

- The world command sender reactive components and reactive component systems are now properly conditionally compiled. [#1059](https://github.com/spatialos/gdk-for-unity/pull/1059)

### Internal

- Added extension methods on the `SchemaObject` struct for easy serializing/deserializing of the `Entity` schema type. [#1053](https://github.com/spatialos/gdk-for-unity/pull/1053)
Expand Down
8 changes: 8 additions & 0 deletions UPGRADE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ private class MyDynamicHandler : Dynamic.IHandler
}
```

#### Reactive components

> If you were not using reactive components previously, no action is required.

Reactive components are now **opt in** instead of **opt out**. To enable them, add the scripting define `USE_LEGACY_REACTIVE_COMPONENTS` to your project.

Reactive components will be removed in a future release, **we strongly recommend to migrate off reactive components**. You can find the APIs to replace reactive components in the [ECS workflows documentation](https://docs.improbable.io/unity/alpha/reference/workflows/overview).

## From `0.2.4` to `0.2.5`

### NPM Packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,9 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<global::Improbable.TestSchema.ExhaustiveRepeatedData> A;
public Option<global::Improbable.TestSchema.SomeEnum> B;
Expand All @@ -861,7 +863,7 @@ public struct Update : ISpatialComponentUpdate
public Option<global::System.Collections.Generic.Dictionary<global::Improbable.TestSchema.SomeEnum,global::Improbable.TestSchema.SomeType>> E;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class DependentComponent
{
internal static class ReferenceTypeProviders
{
#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class UpdatesProvider
{
private static readonly Dictionary<uint, List<global::Improbable.DependentSchema.DependentComponent.Update>> Storage = new Dictionary<uint, List<global::Improbable.DependentSchema.DependentComponent.Update>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;
using Improbable.Gdk.Core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2884,7 +2884,9 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<bool?> Field1;
public Option<float?> Field2;
Expand All @@ -2906,7 +2908,7 @@ public struct Update : ISpatialComponentUpdate
public Option<global::Improbable.TestSchema.SomeEnum?> Field18;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Event(global::Improbable.TestSchema.SomeType payload)
}


#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class ReceivedEvents
{
public struct FooEvent : IComponentData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class DependentDataComponent
{
internal static class ReferenceTypeProviders
{
#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class UpdatesProvider
{
private static readonly Dictionary<uint, List<global::Improbable.DependentSchema.DependentDataComponent.Update>> Storage = new Dictionary<uint, List<global::Improbable.DependentSchema.DependentDataComponent.Update>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using Unity.Entities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;
using Improbable.Gdk.Core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<uint> Root;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<uint> Child;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class DependencyTestChild
{
internal static class ReferenceTypeProviders
{
#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class UpdatesProvider
{
private static readonly Dictionary<uint, List<global::Improbable.Tests.DependencyTestChild.Update>> Storage = new Dictionary<uint, List<global::Improbable.Tests.DependencyTestChild.Update>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;
using Improbable.Gdk.Core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<uint> Grandchild;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class DependencyTestGrandchild
{
internal static class ReferenceTypeProviders
{
#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class UpdatesProvider
{
private static readonly Dictionary<uint, List<global::Improbable.Tests.DependencyTestGrandchild.Update>> Storage = new Dictionary<uint, List<global::Improbable.Tests.DependencyTestGrandchild.Update>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;
using Improbable.Gdk.Core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class DependencyTest
{
internal static class ReferenceTypeProviders
{
#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class UpdatesProvider
{
private static readonly Dictionary<uint, List<global::Improbable.Tests.DependencyTest.Update>> Storage = new Dictionary<uint, List<global::Improbable.Tests.DependencyTest.Update>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;
using Improbable.Gdk.Core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,9 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<global::Improbable.Gdk.Core.EntitySnapshot> Field1;
public Option<global::Improbable.Gdk.Core.EntitySnapshot?> Field2;
Expand All @@ -969,7 +971,7 @@ public struct Update : ISpatialComponentUpdate
public Option<global::System.Collections.Generic.Dictionary<string,global::Improbable.Gdk.Core.EntitySnapshot>> Field5;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class ExhaustiveEntity
{
internal static class ReferenceTypeProviders
{
#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class UpdatesProvider
{
private static readonly Dictionary<uint, List<global::Improbable.TestSchema.ExhaustiveEntity.Update>> Storage = new Dictionary<uint, List<global::Improbable.TestSchema.ExhaustiveEntity.Update>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;
using Improbable.Gdk.Core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3478,7 +3478,9 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<global::System.Collections.Generic.Dictionary<bool,string>> Field1;
public Option<global::System.Collections.Generic.Dictionary<float,string>> Field2;
Expand All @@ -3500,7 +3502,7 @@ public struct Update : ISpatialComponentUpdate
public Option<global::System.Collections.Generic.Dictionary<global::Improbable.TestSchema.SomeEnum,string>> Field18;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class ExhaustiveMapKey
{
internal static class ReferenceTypeProviders
{
#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public static class UpdatesProvider
{
private static readonly Dictionary<uint, List<global::Improbable.TestSchema.ExhaustiveMapKey.Update>> Storage = new Dictionary<uint, List<global::Improbable.TestSchema.ExhaustiveMapKey.Update>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System.Collections.Generic;
using Unity.Entities;
using Improbable.Gdk.Core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DO NOT EDIT - this file is automatically regenerated.
// ===========

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3478,7 +3478,9 @@ public static void ApplyUpdate(global::Improbable.Worker.CInterop.SchemaComponen

public struct Update : ISpatialComponentUpdate
{
#if USE_LEGACY_REACTIVE_COMPONENTS
internal static Stack<List<Update>> Pool = new Stack<List<Update>>();
#endif

public Option<global::System.Collections.Generic.Dictionary<string,bool>> Field1;
public Option<global::System.Collections.Generic.Dictionary<string,float>> Field2;
Expand All @@ -3500,7 +3502,7 @@ public struct Update : ISpatialComponentUpdate
public Option<global::System.Collections.Generic.Dictionary<string,global::Improbable.TestSchema.SomeEnum>> Field18;
}

#if !DISABLE_REACTIVE_COMPONENTS
#if USE_LEGACY_REACTIVE_COMPONENTS
public struct ReceivedUpdates : IComponentData
{
internal uint handle;
Expand Down
Loading