unity-version-split

Split C# files into Unity 6.5+ and pre-6.5 variants with preprocessor guards.

3.8k|349|Updated Apr 2, 2025
One-click install
npx skills add https://github.com/IvanMurzak/Unity-MCP --skill unity-version-split
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-version-split
Source: https://github.com/IvanMurzak/Unity-MCP/tree/main/Unity-MCP-Plugin/.claude/skills/unity-version-split
Command: npx skills add https://github.com/IvanMurzak/Unity-MCP --skill unity-version-split

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers manage Unity projects that target multiple API versions by automatically organizing code into Unity 6.5+ and pre-Unity 6.5 variants, reducing merge conflicts and compilation errors.

Core Features & Use Cases

  • Split files into Unity 6.5+ and pre-Unity 6.5 variants using file naming conventions and preprocessor guards.
  • Maintain two codepaths with minimal duplication while keeping shared logic in sync.
  • Use case: porting scripts to older Unity versions or supporting both runtimes in a single project.

Quick Start

Provide the path to the C# file to split and the tool will generate two versioned files with proper guards

Frequently Asked Questions about unity-version-split

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

FAQPage Schema
How do I split C# scripts for different Unity API versions in one project?

Splitting C# scripts for multiple Unity API versions involves generating two file variants with preprocessor guards. This tool identifies API-version differences and creates paired files using UNITY_6000_5_OR_NEWER guards for Unity 6.5+ code and matching naming for pre-Unity 6.5 fallbacks.

What preprocessor define should I use for Unity 6.5 compatibility checks?

For Unity 6.5 compatibility checks, use the UNITY_6000_5_OR_NEWER preprocessor define. This guard ensures version-specific C# code executes only on Unity 6.5 or newer, while the alternate fallback code path runs on older Unity versions.

How do I maintain two Unity codepaths without causing merge conflicts?

Maintaining two Unity codepaths without merge conflicts is achieved by separating version-specific logic into distinct files with automated preprocessor guards. This tool generates paired variants with matching namespaces and headers, reducing duplication while keeping shared logic synchronized.

Can I port Unity 6.5 scripts to older versions using preprocessor splits?

Yes, you can port Unity 6.5 scripts to older versions using preprocessor splits. This tool creates a pre-Unity 6.5 variant alongside the original, applying appropriate guards so both runtimes compile correctly within a single project without errors.

Does this code splitting tool preserve namespaces and copyright headers across both Unity variants?

Yes, this code splitting tool preserves namespaces and copyright headers across both Unity variants. It ensures both generated files share the same namespace, retain the original copyright header, and end with matching #endif directives for assets-refresh readiness.

What are the limitations of using preprocessor directives for Unity version compatibility?

A limitation of using preprocessor directives for Unity version compatibility is that both codepaths remain in the project, requiring manual synchronization of shared logic. This tool minimizes duplication but cannot automatically merge divergent APIs, so developers must maintain both variants.