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

Fix bug where CommandSender would not reenable after being disabled #1429

Merged
merged 6 commits into from
Jul 17, 2020

Conversation

jamiebrynes7
Copy link
Contributor

@jamiebrynes7 jamiebrynes7 commented Jul 17, 2020

Description

If you have a behaviour that looks like:

public class MyBehaviour : MonoBehaviour 
{
	[Require] private ComponentCommandSender sender;
	[Require] private OtherComponentCommandReceiver receiver;
}

If this behaviour is disabled due to OtherComponent losing authority, receiver will be set to null and the underlying object has IsValid set to false.

If then the behaviour is re-enabled due to OtherComponent gaining authority, receiver will be re-injected, but IsValid will not be set to true.

This is the same bug as #1326, but for the sender rather than the readers. The fix is to have everything implement IRequireable. This is a consequence of #1297 where we changed the behaviour of behaviours with multiple requireables.

Tests

Test cases for reader/writer/commandsender/commandreceiver

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/XS Denotes a PR that changes 0-14 lines, ignoring generated files. labels Jul 17, 2020
@improbable-prow-robot improbable-prow-robot added the A: core Area: Core GDK label Jul 17, 2020
@improbable-prow-robot improbable-prow-robot added A: playground Area: Playground size/M Denotes a PR that changes 40-149 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-14 lines, ignoring generated files. labels Jul 17, 2020
@jamiebrynes7 jamiebrynes7 marked this pull request as ready for review July 17, 2020 14:53
@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 Jul 17, 2020
.Step((world, behaviour) =>
{
Assert.IsNull(behaviour.CommandReceiver);
Assert.IsNull(behaviour.CommandSender);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check if the captured command sender/receiver is invalidated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jamiebrynes7 jamiebrynes7 changed the title Fix bug where CommandSender would not re-enable after being disabled Fix bug where CommandSender would not reenable after being disabled Jul 17, 2020
@jamiebrynes7 jamiebrynes7 merged commit 593bc38 into develop Jul 17, 2020
@improbable-prow-robot improbable-prow-robot deleted the bugfix/sender-not-being-reenabled branch July 17, 2020 15:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: core Area: Core GDK A: playground Area: Playground jira/no-ticket Indicates a PR has no corresponding JIRA ticket size/M Denotes a PR that changes 40-149 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants