CoplayDev/unity-mcp · error · Exception
GameObject '{go.name}' does not have a ProBuilderMesh compon
Error message
GameObject '{go.name}' does not have a ProBuilderMesh component. What it means
Thrown by RequireProBuilderMesh when the target GameObject was found but does not have a ProBuilderMesh component. The tool uses reflection (GetComponent against _proBuilderMeshType) to locate the component, so the object must be an actual ProBuilder shape, not a standard Unity primitive or mesh.
Source
Thrown at MCPForUnity/Editor/Tools/ProBuilder/ManageProBuilder.cs:283
internal static GameObject FindTarget(JObject @params)
{
return ObjectResolver.ResolveGameObject(@params["target"], @params["searchMethod"]?.ToString());
}
private static Component GetProBuilderMesh(GameObject go)
{
return go.GetComponent(_proBuilderMeshType);
}
internal static Component RequireProBuilderMesh(JObject @params)
{
var go = FindTarget(@params);
if (go == null)
throw new Exception("Target GameObject not found.");
var pbMesh = GetProBuilderMesh(go);
if (pbMesh == null)
throw new Exception($"GameObject '{go.name}' does not have a ProBuilderMesh component.");
return pbMesh;
}
internal static void RefreshMesh(Component pbMesh)
{
// ToMesh and Refresh have optional parameters (MeshTopology, RefreshMask) —
// Type.EmptyTypes won't find them. Use name-only lookup with default args.
var toMeshMethod = _proBuilderMeshType.GetMethod("ToMesh", Type.EmptyTypes)
?? _proBuilderMeshType.GetMethod("ToMesh", BindingFlags.Instance | BindingFlags.Public);
toMeshMethod?.Invoke(pbMesh, toMeshMethod.GetParameters().Length > 0
? new object[toMeshMethod.GetParameters().Length]
: null);
var refreshMethod = _proBuilderMeshType.GetMethod("Refresh", Type.EmptyTypes)
?? _proBuilderMeshType.GetMethod("Refresh", BindingFlags.Instance | BindingFlags.Public);
refreshMethod?.Invoke(pbMesh, refreshMethod.GetParameters().Length > 0
? new object[refreshMethod.GetParameters().Length]
: null);View on GitHub (pinned to c21bf496bc)
Solutions
- Create the shape using the ProBuilder create_shape tool so it gets a ProBuilderMesh component.
- Use ProBuilder's 'ProBuilderize' (or the tool's conversion action if available) to add a ProBuilderMesh to an existing mesh.
- Verify with read_components that a ProBuilderMesh is attached before calling mesh-editing operations.
- If the object is a standard primitive, replace it with a ProBuilder shape of the same type.
Example fix
// before: GameObject created via manage_gameobject
// then calling: manage_probuilder bevel on it
// after: create via ProBuilder first
params = {"action": "create", "shapeType": "Cube", "name": "MyShape"} Defensive patterns
Strategy: validation
Validate before calling
# Before calling ProBuilder mesh operations, verify the component exists
# Use read_components on the target and check for a ProBuilderMesh
def has_probuilder_mesh(components):
return any(c.get('type') == 'ProBuilderMesh' for c in components) Try / catch
try
{
var mesh = RequireProBuilderMesh(@params);
}
catch (Exception ex) when (ex.Message.Contains("does not have a ProBuilderMesh"))
{
return new ErrorResponse($"Target is not a ProBuilder shape. Create it via create_shape first.");
} Prevention
- Always create geometry via ProBuilder's create_shape when you intend to use ProBuilder tools.
- Check component presence with read_components before mesh-editing operations.
- Do not mix standard primitives with ProBuilder workflows.
- After ProBuilderize operations, verify the ProBuilderMesh was added successfully.
When it happens
Trigger: Calling a ProBuilder tool (bevel, extrude, set_material, etc.) on a standard Unity primitive (GameObject.CreatePrimitive), a custom mesh object, or a GameObject that has never been ProBuilder-ized. Also if the ProBuilder package is installed but the object was created without ProBuilder APIs.
Common situations: AI creates a GameObject via manage_gameobject (not ProBuilder) then tries to run ProBuilder operations on it; converting a standard mesh to ProBuilder was skipped; the ProBuilder package version exposes a different component type name.
Related errors
- Target GameObject not found.
- Could not read faces from ProBuilderMesh.
- Failed to resolve Scene view host view.
- {hostView.GetType().FullName}.GrabPixels(RenderTexture, Rect
- Face index {indices[i]} out of range (0-{facesList.Count - 1
AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13).
Data as JSON: /api/errors/5d61ddb5277118d8.
Report an issue: GitHub.