unity-asset-safety

Prevents silent Unity asset data loss when editing prefabs, scenes, and serialized fields.

Updated Apr 27, 2024
One-click install
npx skills add https://github.com/IgorGribowsky/rts-sandbox --skill unity-asset-safety-igorgribowsky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-asset-safety
Source: https://github.com/IgorGribowsky/rts-sandbox/tree/main/rts-sandbox-src/.claude/skills/unity-asset-safety
Command: npx skills add https://github.com/IgorGribowsky/rts-sandbox --skill unity-asset-safety-igorgribowsky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity loses and corrupts asset data silently, without any console error: renamed scripts break prefab references, changed code defaults never reach serialized values, Play mode edits vanish, and scene-instance overrides block prefab changes. This Skill provides the rules and verification workflow to avoid these hidden data-loss traps when modifying Unity assets. ## Core Features & Use Cases - Rename and GUID Safety: Enforces keeping .meta files with their assets, matching .cs filenames to MonoBehaviour class names, and using [FormerlySerializedAs] when renaming serialized fields. - Prefab and Override Discipline: Directs edits to the prefab rather than scene instances, and checks for stale overrides that silently block prefab changes. - Play Mode and Code-Driven Edit Rules: Warns about Play mode changes being lost (except ScriptableObjects, which persist to disk), and restricts code-driven asset edits that bypass undo. - Use Case: Before renaming a MonoBehaviour or changing a balance value in a Unity RTS project, consult this Skill to verify actual serialized values on disk, confirm Force Text serialization, and avoid silently breaking prefab references. ## Quick Start Before modifying any Unity prefab, scene, material, or ScriptableObject, ask the assistant to apply the unity-asset-safety rules and verify the actual serialized values from disk after the edit.

Frequently Asked Questions about unity-asset-safety

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

FAQPage Schema
Why does my Unity prefab show 'missing script' after renaming a class?

The .cs filename must match the MonoBehaviour class name, and the .meta file must move with the asset. If they diverge, Unity assigns a new GUID and all scene and prefab references break silently, losing inspector-configured values.

How do I safely rename a serialized field in Unity without losing data?

Add the [FormerlySerializedAs("oldName")] attribute to the renamed field so existing assets map their stored values to the new name. Without it, data saved under the old field name is silently lost.

Why didn't my changed default value in C# apply to existing prefabs?

Changing an initializer like [SerializeField] private float speed = 5f only affects new instances. Existing prefabs keep the value serialized in their files, so you must read and update the actual values stored on disk.

Do Play mode changes in Unity get saved?

Component changes made in Play mode are discarded on exit, but ScriptableObject edits persist to disk. This asymmetry silently corrupts balance configs, so avoid tweaking assets during Play mode.

What types does Unity serialization not support?

Unity does not serialize Dictionaries, interfaces, object, properties without backing fields, static or readonly fields, most generic types, non-[Serializable] nested classes, or multidimensional arrays. These fields appear silently empty in the inspector.