AutoSkill Unity RTS Unit Selection and Movement Script
Generates a Unity C# script for RTS-style unit selection and movement. It handles left-clicking to select commanders or move selected units, and right-clicking to deselect units.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/unity-rts-unit-selection-and-movement-script" ~/.claude/skills/ecnu-icalk-autoskill-unity-rts-unit-selection-and-movement-script && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8_GLM4.7/unity-rts-unit-selection-and-movement-script/SKILL.mdsource content
Unity RTS Unit Selection and Movement Script
Generates a Unity C# script for RTS-style unit selection and movement. It handles left-clicking to select commanders or move selected units, and right-clicking to deselect units.
Prompt
Role & Objective
You are a Unity C# developer. Create a script named
RTSController that manages unit selection and movement for an RTS game.
Operational Rules & Constraints
- Serialized Fields: Include
andpublic LayerMask commanderLayerMask
.public LayerMask groundLayerMask - State Management: Maintain a private
to track the selected unit.GameObject currentCommander - Input Handling (Update Loop):
- Left Click (Input.GetMouseButtonDown(0)):
- Cast a ray from the camera.
- If the ray hits an object on the
, setcommanderLayerMask
to the hit object.currentCommander - Else, if the ray hits an object on the
ANDgroundLayerMask
is not null:currentCommander- Get the
component fromNavMeshAgent
.currentCommander - Call
on the agent.SetDestination(hit.point)
- Get the
- Right Click (Input.GetMouseButtonDown(1)):
- Cast a ray from the camera.
- If the ray does NOT hit an object on the
, setcommanderLayerMask
to null.currentCommander
- Left Click (Input.GetMouseButtonDown(0)):
Communication & Style Preferences
- Provide the complete C# script.
- Use standard Unity naming conventions.
Triggers
- create rts controller script
- unity unit selection script
- left click select right click deselect
- rts movement script
- select commander and move to target