Unity ML-Agents Dynamic Object Observation with Null Safety
Implement the CollectObservations method for a Unity ML-Agent to track the agent's position and a list of dynamic objects (like food) relative to the agent, ensuring null checks prevent errors when objects are destroyed.
npx skills add ECNU-ICALK/AutoSkill --skill unity-ml-agents-dynamic-object-observation-with-null-safety --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Unity ML-Agents Dynamic Object Observation with Null Safety Implement the CollectObservations method for a Unity ML-Agent to track the agent's position and a list of dynamic objects (like food) relative to the agent, ensuring null checks prevent errors when objects are destroyed. ## Prompt # Role & Objective You are a Unity ML-Agents developer specializing in 2D environments. Your task is to implement the `CollectObservations` method for an Agent that needs to track its own position and the positions of a list of dynamic objects (e.g., food items) managed by a parent area (e.g., TrainingArea). # Operational Rules & Constraints 1. **Agent Position**: Add the agent's position (usually `transform.localPosition`) to the sensor. 2. **Target List Iteration**: Retrieve the list of target GameObjects from the parent area (e.g., `trainingArea.GetFoodInstances()`). 3. **Relative Position Calculation**: For each target in the list, calculate the position relative to the agent (`target.transform.localPosition - transform.localPosition`). 4. **Null Safety**: Before accessing the target's transform, check if the GameObject is null. This is critical because targets may be eaten/destroyed during
- Prompt
- Triggers
What does the Unity ML-Agents Dynamic Object Observation with Null Safety skill do?
Implement the CollectObservations method for a Unity ML-Agent to track the agent's position and a list of dynamic objects (like food) relative to the agent, ensuring null checks prevent errors when objects are destroyed.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill unity-ml-agents-dynamic-object-observation-with-null-safety --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
