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

Requireable constraint tweaks & bugfixing #1297

Merged
merged 6 commits into from
Feb 20, 2020

Conversation

jamiebrynes7
Copy link
Contributor

@jamiebrynes7 jamiebrynes7 commented Feb 19, 2020

Description

This PR makes some changes to when a field annotated with [Require] have IsValid set to false and the value set to null.

Previously this would only happen when a GameObject was unlinked from the underlying entity, typically when the entity had left the worker's view (unless a user had some custom logic). This means that if you had a MonoBehaviour like:

public MyBehaviour : MonoBehaviour {
    [Require] public HealthReader HealthReader;
}

if the underlying Health component left your view, say through a QBI query the HealthReader field would be left injected and IsValid would still be true. If you copied the reference or captured it in a closure, this could result in bad behaviour.

Now, when the required field's constraints are no longer met, HealthReader.IsValid is set to false and the MonoBehaviour's field is nulled out.


A consequence of this change in behaviour is that now if you have multiple required fields on a single behaviour, if one of them no longer matches the constraints, every field will be null-ed out and IsValid will be set to false

Tests

  • Tests which cover the behaviour with a single field on a MonoBehaviour.
  • Tests which cover the behaviour with multiple fields on a MonoBehaviour.
  • Tested the FPS with multi-worker.

Documentation

  • Changelog

@improbable-prow-robot improbable-prow-robot added jira/no-ticket Indicates a PR has no corresponding JIRA ticket do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 150-299 lines, ignoring generated files. A: core Area: Core GDK A: game-object-creation Area: Gameobject creation feature module labels Feb 19, 2020
@jamiebrynes7 jamiebrynes7 force-pushed the tests/requireables-isvalid-tests branch from 28a8be3 to 719965b Compare February 19, 2020 11:28
@improbable-prow-robot improbable-prow-robot added size/XL Denotes a PR that changes 300-599 lines, ignoring generated files. and removed size/L Denotes a PR that changes 150-299 lines, ignoring generated files. labels Feb 19, 2020
@jamiebrynes7 jamiebrynes7 force-pushed the tests/requireables-isvalid-tests branch from 719965b to 2aec57c Compare February 20, 2020 12:27
@jamiebrynes7
Copy link
Contributor Author

Tested against FPS w/ multiple workers. Seemed to work as expected. Will write up a changelog entry.

@jamiebrynes7 jamiebrynes7 force-pushed the tests/requireables-isvalid-tests branch from 2aec57c to fe98c31 Compare February 20, 2020 15:47
@jamiebrynes7 jamiebrynes7 changed the title (WIP) Requireable tweaks Requireable constraint tweaks & bugfixing Feb 20, 2020
…is no longer satisfied

tweak requiredsubscriptionsinjector
@jamiebrynes7 jamiebrynes7 force-pushed the tests/requireables-isvalid-tests branch from fe98c31 to 7acf43c Compare February 20, 2020 15:56
@jamiebrynes7 jamiebrynes7 marked this pull request as ready for review February 20, 2020 15:56
@improbable-prow-robot improbable-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 20, 2020
Jamie Brynes added 3 commits February 20, 2020 16:00
@jamiebrynes7 jamiebrynes7 merged commit 6afb018 into develop Feb 20, 2020
@jamiebrynes7 jamiebrynes7 deleted the tests/requireables-isvalid-tests branch February 20, 2020 18:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: core Area: Core GDK A: game-object-creation Area: Gameobject creation feature module jira/no-ticket Indicates a PR has no corresponding JIRA ticket size/XL Denotes a PR that changes 300-599 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants