Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for missing AbstractBoard, display warning #5276

Merged
merged 1 commit into from
Apr 16, 2021
Merged

Conversation

chriselion
Copy link
Contributor

Proposed change(s)

If the AbstractBoard is missing, sensor creation will fail. I think it makes sense to just return empty arrays for the sensors and actuators in this case.

Also added a warning to the respective editor components.

I tried, but we can't add [RequireComponent(typeof(AbstractBoard))], since AbstractBoard is, well, abstract.

Types of change(s)

  • Bug fix

Checklist

  • Added tests that prove my fix is effective or that my feature works

var gameObj = new GameObject("board");
var actuatorComponent = gameObj.AddComponent<Match3ActuatorComponent>();
var actuators = actuatorComponent.CreateActuators();
Assert.AreEqual(0, actuators.Length);
Copy link
Contributor

Choose a reason for hiding this comment

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

might be good to also check it doesn't throw exceptions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it did throw exceptions, the test would fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh ok then it's good

@chriselion chriselion merged commit 2fae4c0 into main Apr 16, 2021
@delete-merged-branch delete-merged-branch bot deleted the fix-no-board branch April 16, 2021 02:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants