diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index 8a028abaccc..af608358fd2 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Minor Changes +#### com.unity.ml-agents (C#) +- Make `BehaviorParametersEditor` create new sensors only when needed. (#6318, #6323) + ## [4.1.0] - 2026-07-27 ### Major Changes #### ml-agents / ml-agents-envs diff --git a/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs b/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs index 5518ac3db82..ae35e543c19 100644 --- a/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs +++ b/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs @@ -122,8 +122,12 @@ void DisplayFailedModelChecks() { return; } - agent.sensors = new List(); - agent.InitializeSensors(); + + if (!EditorApplication.isPlaying || agent.sensors == null) + { + agent.sensors = new List(); + agent.InitializeSensors(); + } var sensors = agent.sensors.ToArray(); ActuatorComponent[] actuatorComponents;