This repository was archived by the owner on Jan 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
test-project/Assets/EditmodeTests/Subscriptions
workers/unity/Packages/io.improbable.gdk.core/Subscriptions Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,29 @@ public void Injection_happens_if_all_constraints_are_satisfied()
114114 Assert . IsNotNull ( compositeBehaviour . Writer ) ;
115115 }
116116
117+ [ Test ]
118+ public void Injection_happens_if_inherited_constraints_are_satisfied ( )
119+ {
120+ ReceiveSystem . Update ( ) ;
121+
122+ createdGameObject = CreateAndLinkGameObjectWithComponent < InheritanceBehaviour > ( EntityId ) ;
123+ var inheritanceBehaviour = createdGameObject . GetComponent < InheritanceBehaviour > ( ) ;
124+
125+ Assert . IsTrue ( inheritanceBehaviour . enabled ) ;
126+ Assert . IsNotNull ( inheritanceBehaviour . OwnReader ) ;
127+ }
128+
117129#pragma warning disable 649
130+ private class InheritanceBehaviour : BaseBehaviour
131+ {
132+ public PositionReader OwnReader => Reader ;
133+ }
134+
135+ private class BaseBehaviour : MonoBehaviour
136+ {
137+ [ Require ] protected PositionReader Reader ;
138+ }
139+
118140 private class PositionReaderBehaviour : MonoBehaviour
119141 {
120142 [ Require ] public PositionReader Reader ;
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ internal class RequiredSubscriptionsInfo
1111
1212 public RequiredSubscriptionsInfo ( Type type )
1313 {
14- var fields = type . GetFields ( BindingFlags . Instance | BindingFlags . Public | BindingFlags . GetField |
15- BindingFlags . NonPublic ) ;
14+ var fields = type . GetFields ( BindingFlags . Instance | BindingFlags . Public | BindingFlags . NonPublic ) ;
1615
1716 RequiredFields = new List < FieldInfo > ( ) ;
1817
You can’t perform that action at this time.
0 commit comments