Black CraftDev

Docs/Meshes

Create Prefab

Make prefabs from the selected models, prefabs or meshes, with the selected materials or textures put on their slots.

EditionPro only · launching soonMenuTools›BlackCraft›Hexbench›Meshes›Create From Selection›PrefabClassCreatePrefabWindow

Select one or more models in the Project window, right-click and choose BlackCraft > Create Prefab. Each model gets a prefab saved beside it, named after it. The same command is under Tools›BlackCraft›Hexbench›Meshes›Create From Selection›Prefab.

With only models selected, every slot keeps the material the model imports with. Select materials along with the models and each material goes to the slot whose name it shares.

Textures in the selection are sorted into materials by name and built the way Create From Selection builds one, on the project's Pipeline Default. Crate_Lid_Albedo and Crate_Lid_Normal make one material called Crate Lid. A map whose name starts several others, such as a Crate_Normal beside Crate_Lid_Albedo and Crate_Body_Albedo, goes into each of those materials.

Materials and textures can be mixed in one selection, and a prefab or a standalone mesh asset works as a source too. A prefab becomes a variant of itself, named with a Variant suffix; a mesh becomes a prefab with one renderer.

How slots are matched

A slot is matched against the name of the material it has now, then the name of its renderer, then the name of the model. Words are compared, so M_Crate_Lid, Crate Lid and crateLid count as the same name, and prefixes such as M_, SM_ and importer names such as lambert1 are ignored. With two models and their textures selected together, each model takes the material that carries its own name.

When the selection holds a single material, every slot no name matched gets it. That is the quick way to put one trim sheet on a whole set of models.

Options

Create Prefab (Options...) opens a window that follows the selection and lists every prefab with each of its slots. Each slot has a dropdown for picking a different material from the selection, or for keeping what it has. A slot tagged pick matched several materials equally well and keeps its material until you choose. A material tagged unused matched no slot.

Kind makes a Prefab Variant of the model, which follows the model through re-imports, or a Plain Prefab, a copy of its hierarchy that still points at the model's meshes. Materials are set on the prefab, and the model's own import settings are left alone.

Collider adds a Box fitted around every renderer, or a Mesh or Convex Mesh collider on each mesh. A source that already has colliders gets none, and a skinned mesh gets no mesh collider.

If It Exists decides what happens when a prefab of that name is already there. Keep Both numbers the new one. Replace writes over it and keeps its guid, so scene instances stay linked, but anything added to that prefab by hand is lost.

Prefix goes on the front of each prefab's name, unless the name already starts with it. Folder saves every prefab in one place; left empty, each is saved beside its source.

The one-click command uses the window's last Kind, Collider and Prefix. It always saves beside the source and never replaces a prefab.

Re-runs and re-exports

Running it again on the same textures reuses the materials it built the first time; their names show as existing in the window.

A variant stores its material overrides by slot number. If the model is exported again with its submeshes in a different order, those materials land on the wrong slots, so check variants after a re-export that adds or removes materials.

Prefabs are put together in a preview scene, so the open scene is not changed or marked dirty. The shortcut Hexbench > Create Prefab From Selection starts unbound; set a key in Edit > Shortcuts.

prefabprefab variantmodelfbxmeshmaterialtexturescolliderselectioncontext menu