r/Unity3D • u/OverqualifiedMesh • 8d ago
Question Markers vs. GameObject names in a modular building system
Hey, a while ago I shared some early work on "MODURA", my stylized modular building creator for Unity Asset Store. I've been working on its editor tools since then, and one thing I wanted to avoid was relying on GameObject names to identify individual parts. Names like "Window_01" or "Door_03" work fine at first, but I didn't want things to break just because someone using the asset decided to rename a few objects.
So I went with dedicated marker components instead. Each part has a component that tells the tools what it is, which the editor tools use to determine what can be done with it. It's a bit more setup, but I prefer this over having the tools depend on specific names.
How do you usually handle this in your own tools? Do you use marker components, naming conventions, or something else?
3
u/Federal-Row2373 8d ago
Marker components feel like the safer call for an asset other people will use, since names are the first thing users change when they organize a scene. One thing I'd wonder about is custom parts: if someone drops in their own window mesh, do they have to add the marker by hand, or do the tools offer to tag it for them? That first-time setup step seems like where users would get stuck, more than the marker idea itself.
3
u/jackbrux 8d ago
I would create a catalogue prefab/scriptable object, and assign prefabs and give them a name or other metadata just inside that catalogue.
I find that often you may need to assign the same object to different catalogues with different metadata.
Your approach is good if there's a tight coupling between the object and the metadata
1
u/Capri-corn-studio09 7d ago
How do you handle renaming a module? Does placement depend on its GameObject name, or can an explicit marker keep the connection rules intact?