cocos_make_click_event
Create click event configurations for Cocos Creator buttons to trigger specific script methods when users interact with UI elements.
Instructions
Build a cc.ClickEvent dict for use with cocos_add_button's click_events.
Args: target_node_id: Node that holds the script (array index) component_name: @ccclass name (e.g. 'GameManager') handler: Method name to call (e.g. 'onStartClick')
Returns a dict to pass in click_events list of cocos_add_button.
Example workflow: evt = cocos_make_click_event(scene, gm_node, 'GameManager', 'onStart') cocos_add_button(scene, btn_node, click_events=[evt])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| target_node_id | Yes | ||
| component_name | Yes | ||
| handler | Yes | ||
| custom_data | No |