Skip to content

BehaviorParametersEditor: create new sensors only when needed. - #6323

Merged
Codengineer merged 4 commits into
developfrom
viviane/keepSensors
Aug 12, 2026
Merged

Codengineer merged 4 commits into
developfrom
viviane/keepSensors

Conversation

@montplaisir

Copy link
Copy Markdown
Contributor

Proposed change(s)

Make BehaviorParametersEditor create new sensors only when needed.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

Fixes #6318

Types of change(s)

  • Bug fix

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Harness Review

LGTM

The play-mode cache reuse avoids the repeated sensor recreation, but it can retain a sensor list across an agent disable/enable lifecycle that no longer represents the components to be initialized.

Reviewed commit 97146cc

🤖 Helpful? 👍/👎

Comment thread com.unity.ml-agents/Editor/BehaviorParametersEditor.cs
@montplaisir

Copy link
Copy Markdown
Contributor Author

/review

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Harness Review

Needs changes

The play-mode reuse path correctly avoids replacing an active agent’s live sensors, but the new uninitialized-agent branch can repeatedly create resource-owning sensors without releasing the prior temporary instances.

Reviewed commit 2b32fd1

🤖 Helpful? 👍/👎

Comment thread com.unity.ml-agents/Editor/BehaviorParametersEditor.cs

@Codengineer Codengineer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Codengineer
Codengineer merged commit 3ecb446 into develop Aug 12, 2026
20 checks passed
@montplaisir
montplaisir deleted the viviane/keepSensors branch August 12, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BehaviorParametersEditor clears sensors and memory of an agent

2 participants