script-update-or-create

Updates or creates C# script files and reports compilation errors.

Updated Feb 4, 2024
One-click install
npx skills add https://github.com/sprillion/gem_td --skill script-update-or-create-sprillion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: script-update-or-create
Source: https://github.com/sprillion/gem_td/tree/main/SKILLS/script-update-or-create
Command: npx skills add https://github.com/sprillion/gem_td --skill script-update-or-create-sprillion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Updates or creates C# script files with provided content and reports compilation errors.

Core Features & Use Cases

  • Update or create a script file at a given path using the supplied C# code.
  • Refresh the AssetDatabase at the end to ensure Unity recognizes changes and surface syntax errors for quick remediation.
  • Use cases include automated scaffolding of new scripts, updating existing scripts from external inputs, and integrating with build pipelines.

Quick Start

Provide the filePath and the C# code content to create or update the script.

Frequently Asked Questions about script-update-or-create

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically create or update a C# script file in Unity from external input?

Automating Unity script creation requires a target filePath and C# code content. The process writes the file, refreshes the AssetDatabase to ensure Unity recognizes changes, and returns any syntax errors for debugging.

How can I check for compilation errors after writing a new C# script in a Unity-like pipeline?

Checking for compilation errors after script creation requires running AssetDatabase.Refresh(). This triggers Unity's compiler and surfaces any syntax errors from the newly written C# file for debugging.

Can I overwrite an existing Unity script file with new content automatically?

Yes, overwriting an existing Unity script file requires providing its current filePath and the new C# code content. The operation replaces the file content and refreshes the AssetDatabase to update Unity.

What is the best way to scaffold new C# scripts on-demand in an automated build pipeline?

Scaffolding new C# scripts on-demand requires passing a filePath and generated code content to an automated creation tool. It writes the script and runs AssetDatabase.Refresh to integrate it into the Unity build pipeline.

Why does Unity not recognize my newly created C# script file until I refresh the AssetDatabase?

Unity does not recognize newly created C# script files until AssetDatabase.Refresh is called because the editor needs to reimport assets. Calling refresh ensures Unity detects the file and compiles it to surface syntax errors.

Do I need to manually fix syntax errors after automated script generation in Unity?

You need to manually fix syntax errors after automated script generation because the process only reports them. It writes the provided C# content and returns any compilation errors, leaving remediation to the developer.