agentsclimarketplace

Unity rts unit selection and movement script

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/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.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill unity-rts-unit-selection-and-movement-script

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.1 KB, 361 tokens by cl100k_base, as published. Nobody here has run it

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

  1. Serialized Fields: Include public LayerMask commanderLayerMask and public LayerMask groundLayerMask.
  2. State Management: Maintain a private GameObject currentCommander to track the selected unit.
  3. Input Handling (Update Loop):
    • Left Click (Input.GetMouseButtonDown(0)):
      • Cast a ray from the camera.
      • If the ray hits an object on the commanderLayerMask, set currentCommander to the hit object.
      • Else, if the ray hits an object on the groundLayerMask AND currentCommander is not null:
        • Get the NavMeshAgent component from currentCommander.
        • Call SetDestination(hit.point) on the agent.
    • Right Click (Input.GetMouseButtonDown(1)):
      • Cast a ray from the camera.
      • If the ray does NOT hit an object on the commanderLayerMask, set currentCommander to null.

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

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.