# Code authoring

Prefab patches can be registered without a visual variant. Both code frontends produce the same patch model, so they compose with visual patches and use the same diagnostics.

* [C# prefab patches](/doc/c-prefab-patches-eRzdcoHm7j) covers `PrefabPatchBuilder`, common targets, operations, references, and cache inputs.
* [Lua prefab patches](/doc/lua-prefab-patches-WaaPPHOHcL) covers `PM:Prefab`, scalar shortcuts, reusable targets, and coordination methods.

Use code authoring for compact or generated changes. Use [Visual authoring](/doc/visual-authoring-nYu5hKptCs) when you need to inspect a hierarchy or manage several object references.

---

**Documents**

- [C# prefab patches](https://docs.ksp2redux.org/s/0a4a3e31-0b40-48e0-bd81-e14856f80d3d/doc/c-prefab-patches-eRzdcoHm7j)
- [Lua prefab patches](https://docs.ksp2redux.org/s/0a4a3e31-0b40-48e0-bd81-e14856f80d3d/doc/lua-prefab-patches-WaaPPHOHcL)