unity_component_set_reference
Wire an object reference onto a component property by resolving the target through asset path, scene GameObject name, or instance ID.
Instructions
Wire an object reference on a component property. Resolves by asset path, scene GameObject name, component type, or instance ID (richer than set_property for ObjectReference fields).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Hierarchy path or name of the target GameObject | |
| port | No | Unity instance port (from unity_select_instance). Always include it when multiple instances run. | |
| clear | No | Set to true to clear/null the reference | |
| assetPath | No | Asset path to assign (e.g. 'Assets/Materials/MyMat.mat', 'Assets/Prefabs/Enemy.prefab') | |
| instanceId | No | Instance ID of the target GameObject (alternative to path) | |
| propertyName | Yes | Name of the ObjectReference property to set | |
| componentType | No | Component type containing the property (optional — will auto-search all components) | |
| referenceGameObject | No | Name or hierarchy path of a scene GameObject to assign | |
| referenceInstanceId | No | Instance ID of the object to assign (64-bit-safe string) | |
| referenceComponentType | No | When referencing a scene object, get a specific component instead of the GameObject itself (e.g. 'Camera', 'AudioSource') |