Attach Script to GameObject
unity_attach_scriptAttach a MonoBehaviour script to a GameObject in Unity Editor with undo support. Requires compiled script; fails with a hint if class is missing.
Instructions
Attach a MonoBehaviour class to a GameObject (Undo-able). Script must be compiled — no compile errors in console.
Args: object_path ('Player'), script_class ('PlayerController'). Fails with hint if the class is not found (typo? not compiled yet?) — read the error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| object_path | Yes | Hierarchy path of the GameObject, e.g. 'Player' | |
| script_class | Yes | MonoBehaviour class name to attach, e.g. 'PlayerController' |