fix: resolve target GameObjects through ObjectsHelper everywhere; add include_stack_trace to get_console_logs#30
Open
dehuaichendragonplus wants to merge 1 commit into
Conversation
… include_stack_trace to get_console_logs Rebased onto v0.5.0 (post FunplayAI#28/FunplayAI#29 merge).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this change is needed
Several built-in tools resolved their target GameObject with a bare
GameObject.Findcall:assign_animator,assign_material, camera tools,create_prefab/unpack_prefab,get_object_memory,capture_multiview'starget_name,select_object/focus_on_object,get_hierarchy'sroot_name, and UI-creation tools'parent_name.GameObject.Findcannot find inactive objects and has no way to disambiguate duplicate names -- so any of these tools silently failed or resolved the wrong object whenever the target was deactivated or shared its name with another object in the scene.Separately,
get_console_logshad no way to surface a logged error's stack trace, which made root-causing errors surfaced through the tool harder than necessary.Change approach
ObjectsHelper.FindTarget(name, hierarchy path, or instance ID; inactive objects and additively-loaded scenes included).GameObject.Findcall couldn't handle inactive objects: a recursive inactive-object search inHierarchyFunctionsand aResources.FindObjectsOfTypeAllfallback loop inUIFunctions.FindParent.get_console_logsgained aninclude_stack_traceoption: appends each entry's stack trace (indented, own 2000-character truncation cap independent of the message's 300-character cap). Off by default.ScreenshotFunctions.cs/UIFunctions.cschanges here are limited to the target-resolution call sites and leave the path-traversal hardening from feat: save_to_file on screenshot tools, capture_editor_window, and raycast_at_point UI diagnostics #28 untouched.Benefits
get_console_logsoutput, without bloating the default (300-char message-only) response.Test results
select_objectby nameGameObject.Findwould have failed)create_buttonwithparent_nameset to that inactive GameObjectget_game_object_infoconfirmedParent/Button)Debug.LogError, thenget_console_logs(include_stack_trace=true)Compatibility testing
include_stack_tracedefaults to off, so existingget_console_logscallers see no change in response shape.ScreenshotFunctions.cs/UIFunctions.cschanges are scoped to the target-resolution call sites only; the path-traversal hardening landed in feat: save_to_file on screenshot tools, capture_editor_window, and raycast_at_point UI diagnostics #28 is untouched.Checklist
Funplay > MCP Serveropens and starts correctly (verified indirectly: all MCP tool calls above went through a live running server).idea/or.DS_StoreCHANGELOG.mdwhen the change affects users