Skip to content

scaffold_script emits non-compiling code (TARGET_TYPE placeholder, no name validation, duplicate IState, missing ECS type) #25

Description

@TMHSDigital

Why it matters

scaffold_script is the flagship tool, but several templates produce code that does not compile, and it accepts any name string.

Evidence (mcp-server/server.py)

  • No identifier validation: scaffold_script('monobehaviour', 'My Player', 'Game.Core') emits public class My Player : MonoBehaviour and the path Assets/Scripts/Runtime/My Player.cs.
  • custom-inspector and property-drawer emit typeof(TARGET_TYPE), a literal placeholder with no parameter to fill it.
  • state-machine declares public interface IState in the same file as the class, so scaffolding two state machines in one namespace causes CS0101 (duplicate type).
  • interface does not enforce or suggest the I prefix required by rules/naming-conventions.mdc.
  • test is placed in Assets/Tests/EditMode with no note that it needs a test asmdef, so it will not compile in a default project.
  • README "Features" and the MCP tools table claim scaffolding of "ECS systems" / "ECS templates"; there is no ECS type.

Suggested approach

  • Validate name and namespace against C# identifier rules and reserved keywords; return an error with a suggested fix.
  • Add an optional target_type parameter for inspector and drawer templates.
  • Move IState out of the state-machine template or emit it only on request.
  • Add isystem / ijobentity / baker templates, or remove the ECS claims from README.
  • Return companion asmdef JSON for editor and test scaffolds.
  • Unit tests that render every template and compile it (see the snippet compile-check issue).

Done when

Every template type, for any valid input, produces code that compiles in a fresh Unity 6 project, and invalid names are rejected with a helpful message.

Activity

  1. TMHSDigital commented on Oct 9, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in #49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmcp-serverPython MCP server and datapriority: highTackle first

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions