unity-version-split
Installation
SKILL.md
Unity Version Split
Split a C# source file into two variants: one for Unity 6.5+ (UNITY_6000_5_OR_NEWER) and one for older versions (pre-Unity 6.5).
When to Use
Unity 6.5 introduced breaking changes including:
EntityIdreplacesintfor instance IDs (GetEntityId()replacesGetInstanceID())EditorUtility.EntityIdToObject(EntityId)replacesEditorUtility.InstanceIDToObject(int)- Implicit
EntityId <-> intconversions are marked[Obsolete(..., true)](compile error)
When a file needs different code for these Unity versions, split it into two files following the project convention.
File Naming Convention
| File | Purpose | Preprocessor Guard |
|---|---|---|
FileName.cs |
Unity 6.5+ (newer version) | #if UNITY_6000_5_OR_NEWER |
FileName.pre-Unity.6.5.cs |
Pre-Unity 6.5 (older version) | #if !UNITY_6000_5_OR_NEWER |